Skip to content

Commit 7bdc196

Browse files
committed
fix: improved error message if web server sends a raw HTML error page
1 parent 4ba6052 commit 7bdc196

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

phpmyfaq/assets/src/configuration/update.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,15 @@ export const handleUpdateInformation = async (): Promise<void> => {
7575
const errorMessage = await response.json();
7676
errorText = errorMessage.message || errorMessage.error || 'Update check failed';
7777
} else {
78-
errorText = await response.text();
79-
if (!errorText || errorText === 'Not Found') {
78+
const rawText = await response.text();
79+
if (!rawText || rawText === 'Not Found' || rawText.trimStart().startsWith('<')) {
8080
errorText =
81-
'The requested resource was not found on the server. ' +
82-
'Please check your server configuration, if you use Apache, the RewriteBase in your .htaccess ' +
83-
'configuration. If you use nginx, please check your nginx rewrite configuration.';
81+
'The server returned an error (HTTP ' +
82+
response.status +
83+
'). Please check your server configuration: if you use Apache, verify the RewriteBase in your ' +
84+
'.htaccess matches your installation path. If you use nginx, check your rewrite configuration.';
85+
} else {
86+
errorText = rawText;
8487
}
8588
}
8689
const alert = document.getElementById('phpmyfaq-update-check-alert') as HTMLElement | null;

0 commit comments

Comments
 (0)