be loosy and honor startsWith application/javascript

This commit is contained in:
Wael Nasreddine 2025-12-25 22:54:14 -08:00
parent afcd23cb99
commit 03eaebc71c
2 changed files with 2 additions and 3 deletions

View File

@ -116,8 +116,7 @@ export default class ShareThemeExportProvider extends ZipExportProvider {
return null;
}
// TODO: Should we allow mime to also include backend, i.e loosely check that it starts with application/javascript and ignore the rest?
if (type === "code" && mime === "application/javascript;env=frontend"){
if (mime.startsWith("application/javascript")) {
return "js";
}

View File

@ -149,7 +149,7 @@ interface RenderArgs {
}
function renderNoteContentInternal(note: SNote | BNote, renderArgs: RenderArgs) {
if (renderArgs.isStatic && note.type == "code" && note.mime === "application/javascript;env=frontend") {
if (renderArgs.isStatic && note.mime.startsWith("application/javascript")) {
if (note.isProtected) {
// TODO: how to handle this case here?
throw new Error(`note ${note.noteId} is protected and cannot be exported`);