Skip to content

Commit 1a43923

Browse files
committed
feat: fallback for HTTP_REFERER
1 parent b5c3497 commit 1a43923

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

php-error-log-viewer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ public function link_vscode_files( $string ) {
150150

151151
public function vscode_link_filter( $matches ) {
152152
$link = 'vscode://file/' . $matches[1] . $matches[2] . ':' . $matches[3];
153-
$val = parse_url( $_SERVER['HTTP_REFERER'], PHP_URL_QUERY );
153+
$root = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : $_SERVER['DOCUMENT_ROOT'];
154+
$val = parse_url( $root, PHP_URL_QUERY );
154155
parse_str( $val, $get_array );
155156
$link = str_replace( $this->settings['vscode_path_search'], $this->settings['vscode_path_replace'], $link );
156157
return "<a href='$link'>" . $matches[0] . '</a>';

0 commit comments

Comments
 (0)