Coder Social home page Coder Social logo

jscher2000 / content-type-fixer-extension Goto Github PK

View Code? Open in Web Editor NEW
23.0 23.0 2.0 84 KB

Firefox extension to override dumb Content-Type headers with correct values

License: Mozilla Public License 2.0

JavaScript 82.24% CSS 6.14% HTML 11.62%

content-type-fixer-extension's People

Contributors

jscher2000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

content-type-fixer-extension's Issues

still getting the pop-up menu when downloading PDFs

I have the add-on active and I have selected open pdf with the pdf application but I still get the pop-up window in firefox quite often.

How can I troubleshoot this? I am on Waterfox if that makes any difference.

Just a heads-up - console error

Addon working OK but have been noticing this in the browser console error log:

Error: Please use $(ref:runtime.getURL). background.js:298
startListening moz-extension://0eb85e09-be9b-499d-8124-2c4a0d83f582/background.js:298

Discussion: Prioritizing content type over file extension

I'm starting to see a different type of situation where a URL is requesting a resource say example.tif and it adds an argument to transmit the file as a WEBP file to reduce the size. When trying to save the file, the browser sees the content type as "image/webp" and prompts to save the file as "example.tif".

When tying to open the file, most applications will say that they file is "unrecognized". Obviously renaming the file to example.webp will open properly when using an appropriate viewer.

I personally don't mind WEBP files (to reduce space), but in these type of situations I can not tell if exmaple.tif is a TIF file, WEBP file, or possibly a corrupted file until I try to view the file and then then try different extensions.

I see a handful of possible solutions:

  1. Try to prevent a site from transmitting WEBP files. Could try removing formatting arguments in a URL (tedious for each site if even possible) or even disabling WEBP support for all of Firefox via configuration changes (which could break some sites).
  2. Trust that the content type is correct and override the file extension via an addon in some circumstances. (In this case, save it as example.webp vs. example.tif because the content type is reported as "image/webp")

Example:

https://images.bloomingdalesassets.com/is/image/BLM/products/2/optimized/10631592_fpx.tif?op_sharpen=1&wid=1200&fit=fit,1&$filtersm$&fmt=webp

  • The filename is 10631592_fpx.tif
  • The requested format is webp ("&fmt=webp")
  • Firefox reports the content type as "image/webp"
  • In this case (for me), I would like to be able to save the file as 10631592_fpx.webp.

Any thoughts\suggestions? Do you think I am missing anything?

Could not fix content-type for PDF on shinygarage.pl site

Hi, i'm trying to force opening PDF in browser, but below site is forcing me to download it:
https://shinygarage.pl/plyn-do-mycia-szyb-perfect-glass-cleaner
Scroll to Pliki do pobrania and then try to download Karta charakterystyki (MSDS) - PL (link works here too).
Server send content-type: application/force-download, and extension do not show any log for it.

How to avoid forcing download?

PS. It looks like somehow file handlers.json have entry of application/force-download which force download even for PDF:

"application/force-download":{"action":0,"ask":false,"extensions":["rar"]}

After removing this entry, opening file in browser works even without this extension.

PPS. Temporarily i've changed above to

"application/force-download":{"action":3,"ask":true,"extensions":["rar","pdf"]}

Is handlers.json detection takes place before addon?

No buttons!

Hi. I need to use this to automatically download text files (extension .txt) rather than displaying them in the browser. But I don't see the buttons mentioned to add this extension. Firefox 68.02 Windows 10 Pro.

Any ideas? I attach a screenshot.
log

Some preferences are not getting saved

Steps to produce:

  1. Enable/Disable Content Types
  2. Disable 7z
  3. Restart Firefox
    7z will be enabled when the Firefox restarted. But I would like my preferences to be saved.

I am using Firefox 75 64-bit.

error in content type fixer

Hello,
I'm using your extension Content-Type Fixer version 1.7.2, on firefox 88.0.1 and Windows10.

I sometimes get a strange error: I load a page and it is shown a popup asking to save an html file.
It seems random, sometimes the page loads correctly (without save dialog) and sometimes it doesn't (it shows save dialog).

See these screenshots:

immagine

immagine

And these are the options I set in the extension:

immagine

No "Open with firefox" option downloading a PDF file

There is no "Open with Firefox" option for a PDF file from a specific site, only "Open With Adobe Acrobat Reader" and "Save file".
Firefox contains for "Portable Document Format (PDF)" Content type the "Always ask" action.

I have to set the action to "Open with Firefox" to view the PDF in Firefox.

For other downloads the "Open with Firefox" option exists!

This happens with content-type fixer too, using it's default settings.

In case of download, the file has a generated name, for example BrrGhM8s.pdf

Microsoft Edge shows the file immediately (the default for PDF is Adobe Acrobat Reader)

I attached the log, but I don't know, what can I do, I don't see PDF extension, and only the svg extension entry has Add button.

It's a personal download, the site is password protected.

I hope you can help,

Thanks

JAV Log of Recent Requests 20230327

possible to trigger this on file:// requests?

this might be a generic firefox-addons question, but maybe not... is it possible for me to override the behavior of firefox's own behavior of .md files? I found your reply in this mozilla forum thread, but that's discussing http requests. In chrome I'd often visit ~/TODOs.md and then a separate markdown extension would render that text nicely for me. When I visit file:///home/myuser/TODOs.md in firefox however, it tries to download it (as if served by a server with an HTTP header content-disposition: attachment).

tl;dr When I checkout the "Log of Recent Request" page for this extension, I don't see any of the requests triggered by my file:// browsing.. Is there a button I have to click somewhere to give the addon access to this traffic?

Configure before first launch

Hi,

I'm using Firefox in kiosk mode with your addon.
Is there any way to change the parameters located in trueCT and oPrefs (in the background.js) before the first launch of firefox with Content-type fixer installed ?

Thanks for your help to mozilla's community.

Best regards.

No "Open with firefox" option downloading a PDF file

There is no "Open with Firefox" option for a PDF file from a specific site, only "Open With Adobe Acrobat Reader" and "Save file".
Firefox contains for "Portable Document Format (PDF)" Content type the "Always ask" action.

I have to set the action to "Open with Firefox" to view the PDF in Firefox.

For other downloads the "Open with Firefox" option exists!

This happens with content-type fixer too, using it's default settings.

In case of download, the file has a generated name, for example BrrGhM8s.pdf

Microsoft Edge shows the file immediately (the default for PDF is Adobe Acrobat Reader)

I attached the log, but I don't know, what can I do, I don't see PDF extension, and only the svg extension entry has Add button.

It's a personal download, the site is password protected.

I hope you can help,

Thanks
JAV Log of Recent Requests 20230327

Allow disable for images

When I click on "Download" on an image in Google Photos, instead of downloading it, it opens it in the browser.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.