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

GM_download original server filename parsed wrong #2148

Open
Owyn opened this issue Aug 8, 2024 · 1 comment
Open

GM_download original server filename parsed wrong #2148

Owyn opened this issue Aug 8, 2024 · 1 comment

Comments

@Owyn
Copy link

Owyn commented Aug 8, 2024

When I don't specify a filename for the gm_download and it tries to use the server one - it doesn't parse it properly, e.g.
%20 - doesn't turn into spaces, you just remove % sign leaving 20 there and thus corrupting the filename

server filename which is given

file%20name.jpg

Expected Behavior

file name.jpg

Actual Behavior

file20name.jpg

Specifications

  • FF 129.0
  • TM: 5.1.1
  • OS: Win 10

Script

Example script:

// ==UserScript==
// @name         Test for GM_download
// @namespace    http://tampermonkey.net/
// @version      2025
// @description  try to take over the world!
// @author       You
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @match        https://www.google.com.hk/*
// @match        https://www.google.com/*
// @grant        GM_download
// @include      https://rule34.paheal.net/post/view/13409
// ==/UserScript==

(function() {
    'use strict';

    document.querySelector('#main_image').addEventListener('click', function(){
        console.log("a click on the image");
        GM_download({
            "url": document.querySelector('#main_image').src,
            "name": null,
            "saveAs": true,
            "onload": function(e) {
                console.log("onload: %o", e);
            },
            "onerror": function(e) {
                console.log("onerror: %o", e);
            },
            "onprogress": function(e) {
                console.log("onprogress: %o", e);
            },
            "ontimeout ": function(e) {
                console.log("ontimeout : %o", e);
            }
        });
    });
})();

example url with an image to left click (it will do the gm_download) then compare it with the name it'd give you if you right-click -> save as it: https://rule34.paheal.net/post/view/13409

@derjanb derjanb added the bug label Aug 16, 2024
@derjanb derjanb added this to the 5.3 milestone Aug 16, 2024
@derjanb
Copy link
Member

derjanb commented Aug 28, 2024

Should be fixed at 5.3.6208 (crx|xpi in review)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants