Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web: don't include preview data and options in release mode #2301

Merged
merged 20 commits into from
Aug 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
process gzipped files
fariss committed Aug 19, 2024
commit 0e4872507d4048654191cb45171a07cac11cf863
22 changes: 13 additions & 9 deletions web/explorer/src/composables/useRdocLoader.js
Original file line number Diff line number Diff line change
@@ -45,13 +45,7 @@ export function useRdocLoader() {
}
data = await response.json();
} else if (source instanceof File) {
let fileContent;
if (await isGzipped(source)) {
fileContent = await decompressGzip(source);
} else {
fileContent = await readFileAsText(source);
}
data = JSON.parse(fileContent);
data = await processFile(source);
} else if (typeof source === "object") {
// Direct JSON object (Preview options)
data = source;
@@ -73,15 +67,25 @@ export function useRdocLoader() {
console.error("Error loading JSON:", error);
toast.add({
severity: "error",
summary: "Error",
detail: "Failed to process the file. Please ensure it's a valid JSON or gzipped JSON file.",
summary: "Failed to process the file",
detail: error,
life: 3000,
group: "bc" // bottom-center
});
}
return null;
};

const processFile = async (blob) => {
let fileContent;
if (await isGzipped(blob)) {
fileContent = await decompressGzip(blob);
} else {
fileContent = await readFileAsText(blob);
}
return JSON.parse(fileContent);
};

return {
loadRdoc
};