fix: missing previews

This commit is contained in:
Ibrahima G. Coulibaly
2025-05-22 17:18:36 +01:00
parent 6af2957314
commit 0a68edfbad
3 changed files with 18 additions and 12 deletions

16
.idea/workspace.xml generated
View File

@@ -6,7 +6,8 @@
<component name="ChangeListManager">
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="fix: misc">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/pdf/split-pdf/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/pdf/split-pdf/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/components/input/BaseFileInput.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/input/BaseFileInput.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/pdf/protect-pdf/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/pdf/protect-pdf/service.ts" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -23,7 +24,7 @@
<option name="PUSH_AUTO_UPDATE" value="true" />
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="main" />
<entry key="$PROJECT_DIR$" value="fork/rohit267/feat/pdf-merge" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@@ -134,6 +135,13 @@
"number": 102
},
"lastSeen": 1747171977348
},
{
"id": {
"id": "PR_kwDOMJIfts6XPua_",
"number": 117
},
"lastSeen": 1747929835864
}
]
}]]></component>
@@ -189,7 +197,7 @@
"Vitest.replaceText function (regexp mode).should return the original text when passed an invalid regexp.executor": "Run",
"Vitest.replaceText function.executor": "Run",
"Vitest.timeBetweenDates.executor": "Run",
"git-widget-placeholder": "#102 on fork/rohit267/feat/pdf-merge",
"git-widget-placeholder": "#117 on fork/nevolodia/flip-video",
"ignore.virus.scanning.warn.message": "true",
"kotlin-language-version-configured": "true",
"last_opened_file_path": "C:/Users/Ibrahima/IdeaProjects/omni-tools/src",
@@ -423,6 +431,8 @@
<workItem from="1745775228478" duration="1221000" />
<workItem from="1745835676024" duration="68000" />
<workItem from="1747171958176" duration="1105000" />
<workItem from="1747217211469" duration="4000" />
<workItem from="1747929815472" duration="843000" />
</task>
<task id="LOCAL-00147" summary="chore: update meta">
<option name="closed" value="true" />

View File

@@ -33,18 +33,15 @@ export default function BaseFileInput({
const { showSnackBar } = useContext(CustomSnackBarContext);
useEffect(() => {
if (value) {
try {
if (isArray(value)) {
const objectUrl = createObjectURL(value[0]);
const objectUrl = createObjectURL(value);
setPreview(objectUrl);
return () => revokeObjectURL(objectUrl);
} else {
setPreview(null);
}
} catch (error) {
console.error('Error previewing file:', error);
}
}
}, [value]);
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {

View File

@@ -37,7 +37,6 @@ export async function protectPdf(
password: options.password
};
const protectedFileUrl: string = await protectWithGhostScript(dataObject);
console.log('protected', protectedFileUrl);
return await loadPDFData(
protectedFileUrl,
pdfFile.name.replace('.pdf', '-protected.pdf')