Closed rwv closed 2 years ago
Hmm, it does for me on macOS. What operating system are you on?
Google Chrome 101.0.4951.67
& Edge 101.0.1210.53
on Windows 11 Version 21H2
On macOS it works for me as well. (Chrome 100.0.4896.127
on macOS Version 10.15.6)
Can you try the demo on https://googlechromelabs.github.io/browser-fs-access/demo/ and click "Save Image File" to see if this saves as a .png
?
On Chrome 101.0.4951.67 Windows 10 Version 21H2, the dialog has extension in filename but still does not respect the extensions.
Can you try the demo on https://googlechromelabs.github.io/browser-fs-access/demo/ and click "Save Image File" to see if this saves as a
.png
?
It works!
I tried adding mimeTypes
just now and it works.
Adobe Acrobat 文档
means Adobe Acrobat Document
Code:
await fileSave(blobPromise, {
fileName: filename,
extensions: [".pdf"],
mimeTypes: ["application/pdf"],
});
Oh, interesting. It's very weird that it would work for .png
but not for .pdf
. Thanks for sharing the fix, though.
This happens when mimeTypes
is not set and use Promise<Blob>
Promise<Blob>
causes type
to be null
Therefore, there's no match in the if
chain causes types[i].accept == {}
Oh, interesting. It's very weird that it would work for
.png
but not for
I think it does not work for .png
. This from my observation and experiments seems to be a windows issue. Even saving an image in excalidraw does not respect the extensions. You can refer to #7860 .
This from my observation and experiments seems to be a windows issue.
That's correct. It's a known limitation of the fallback API, so it's always recommended to add both, extensions and MIME types.
Thank you for adding
fileSave
support (https://github.com/rwv/lookscanned.io/pull/8) for lookscanned.io. However,fileSave
does not respectextensions: ['.pdf']
in my setup. Am I doing anything wrong?Screenshot:![image](https://user-images.githubusercontent.com/7891383/170827103-d6fccd37-3bbb-4910-a911-f25e2342d471.png)
The meaning of "所有文件" is "All types"
Therefore, when a user change filename, for example,
doc
. Browser will save file todoc
instead ofdoc.pdf
.Code
Thank you!