From a0001a7caae92f74eed522ccdabefe85aad3d913 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Tue, 11 Feb 2020 20:10:22 +1100 Subject: [PATCH] fix(developer/ide): model debugger mime type mismatch Fixes #2630. The MIME type for .js was being read from the registry, which on some systems has been corrupted to text/plain, which causes Chrome to abort loading the script. The fix is to avoid loading the system registered MIME types, which we don't need anyway, because all the MIME types we are using are in the default hard-coded list. --- .../TIKE/http/Keyman.Developer.System.HttpServer.Base.pas | 6 +++++- .../http/Keyman.Developer.System.HttpServer.Debugger.pas | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/windows/src/developer/TIKE/http/Keyman.Developer.System.HttpServer.Base.pas b/windows/src/developer/TIKE/http/Keyman.Developer.System.HttpServer.Base.pas index 692fba5fc5..3fa77fa3c7 100644 --- a/windows/src/developer/TIKE/http/Keyman.Developer.System.HttpServer.Base.pas +++ b/windows/src/developer/TIKE/http/Keyman.Developer.System.HttpServer.Base.pas @@ -58,7 +58,11 @@ begin Exit; end; - AResponseInfo.ContentType := AResponseInfo.HTTPServer.MIMETable.GetFileMIMEType(AFileName); + if AResponseInfo.ContentType = '' then + begin + AResponseInfo.HTTPServer.MIMETable.LoadTypesFromOS := False; + AResponseInfo.ContentType := AResponseInfo.HTTPServer.MIMETable.GetFileMIMEType(AFileName); + end; AResponseInfo.CharSet := 'UTF-8'; AResponseInfo.ContentLength := FileSizeByName(AFileName); //AResponseInfo.LastModified := GetFileDate(doc); diff --git a/windows/src/developer/TIKE/http/Keyman.Developer.System.HttpServer.Debugger.pas b/windows/src/developer/TIKE/http/Keyman.Developer.System.HttpServer.Debugger.pas index 9ad35f5bc5..fbdc2ba16b 100644 --- a/windows/src/developer/TIKE/http/Keyman.Developer.System.HttpServer.Debugger.pas +++ b/windows/src/developer/TIKE/http/Keyman.Developer.System.HttpServer.Debugger.pas @@ -652,6 +652,7 @@ begin Delete(doc, 1, 6); // Models always expire immediately + AResponseInfo.ContentType := 'application/javascript'; AResponseInfo.Expires := EncodeDate(1990, 1, 1); // I4037 AResponseInfo.CacheControl := 'no-cache, no-store'; // I4037 AResponseInfo.LastModified := Now; // I4037 @@ -686,7 +687,11 @@ begin // Serve the file - AResponseInfo.ContentType := AResponseInfo.HTTPServer.MIMETable.GetFileMIMEType(doc); + if AResponseInfo.ContentType = '' then + begin + AResponseInfo.HTTPServer.MIMETable.LoadTypesFromOS := False; + AResponseInfo.ContentType := AResponseInfo.HTTPServer.MIMETable.GetFileMIMEType(doc); + end; AResponseInfo.CharSet := 'UTF-8'; AResponseInfo.ContentLength := FileSizeByName(doc); //AResponseInfo.LastModified := GetFileDate(doc);