Open DanaMW opened 6 years ago
It will take work to add mimetype support since it's only available after starting downloads.
Firefox also doesn't seem to populate the mime field in the download item right now, so that will require yet another request to get the mimetype.
This is low priority, but it's something I want as well.
Thank you. I was only interested in being able to say slap a jpg extension on files. Not to often that problem comes up except when I am doing all pictures or a; mp4's. Me personally I dont need it to read filetype or anything I was hoping there was a catch I could use, one of your templates , I could use to just slap .jpg on the end of a file with no extension. Then switch the rule to .mp4 when I do movies.
As a naive workaround this a rule like this can work. This doesn't account for the file mimetype, so it can sometimes get it wrong. Someone better at regex can probably come up with a better one.
// Matches images with no dot extension in filename
filename: ^[^\.]+[^\.]{0,5}$
mediatype: image
into: :filename:.jpg
// Matches videos with no dot extension in filename
filename: ^[^\.]+[^\.]{0,5}$
mediatype: video
into: :filename:.mp4
Thank you sir, that will do perfectly for my needs, for now.
Note to self: Mimetype detection might be possible using Blob.type
https://developer.mozilla.org/en-US/docs/Web/API/Blob/type
This will only be available when downloading through the content script.
Wow will be the first thing I say. I thought you were doing good work before. And then all this. Thanlk you very much. My question is with all this is there a way besides the dialog to catch and rewrite an extension on a file? .JPG's and MP4's come up a fair amount without extensions and I was wondering if in this is there is a way to auto apply an extension to a file without one? Thanks a million for your work.