this post was submitted on 24 Dec 2024
8 points (100.0% liked)

Firefox

5 readers
3 users here now

The latest news and developments on Firefox and Mozilla, a global non-profit that strives to promote openness, innovation and opportunity on the web.

You can subscribe to this community from any Kbin or Lemmy instance:

Related

Rules

While we are not an official Mozilla community, we have adopted the Mozilla Community Participation Guidelines as far as it can be applied to a bin.

Rules

  1. Always be civil and respectful
    Don't be toxic, hostile, or a troll, especially towards Mozilla employees. This includes gratuitous use of profanity.

  2. Don't be a bigot
    No form of bigotry will be tolerated.

  3. Don't post security compromising suggestions
    If you do, include an obvious and clear warning.

  4. Don't post conspiracy theories
    Especially ones about nefarious intentions or funding. If you're concerned: Ask. Please don’t fuel conspiracy thinking here. Don’t try to spread FUD, especially against reliable privacy-enhancing software. Extraordinary claims require extraordinary evidence. Show credible sources.

  5. Don't accuse others of shilling
    Send honest concerns to the moderators and/or admins, and we will investigate.

  6. Do not remove your help posts after they receive replies
    Half the point of asking questions in a public sub is so that everyone can benefit from the answers—which is impossible if you go deleting everything behind yourself once you've gotten yours.

founded 2 years ago
MODERATORS
 

Solved: It turns out I needed to add https:// to the redirect URL. I now edited the redirect to be this:

{
    "createdBy": "Redirector v3.5.3",
    "createdAt": "2024-12-25T00:25:04.487Z",
    "redirects": [
        {
            "description": "sh.reddit.com submission page",
            "exampleUrl": "https://old.reddit.com/r/firefox/submit?selftext=true",
            "exampleResult": "https://sh.reddit.com/r/firefox/submit?selftext=true",
            "error": null,
            "includePattern": "https://.*?reddit.com/((r|u|user)/.*?/submit.*)",
            "excludePattern": "",
            "patternDesc": "",
            "redirectUrl": "https://sh.reddit.com/$1",
            "patternType": "R",
            "processMatches": "noProcessing",
            "disabled": false,
            "grouped": false,
            "appliesTo": [
                "main_frame"
            ]
        }, 
    ]
}

Using the Redirector addon, I wrote a redirect from a Reddit submit page to the new new Reddit submit page but it doesn't work when I go to https://old.reddit.com/r/firefox/ and click "submit text", it just takes me to https://old.reddit.com/r/firefox/submit?selftext=true despite the link working in the example box.

Reproduction: Install the addon, save the following as a json file, click on addon icons and select "edit redirects", then click import to select the json file.

{
"createdBy": "Redirector v3.5.3",
"createdAt": "2024-12-22T15:43:42.356Z",
"redirects": [
{
"description": "sh.reddit.com submission page",
"exampleUrl": "https://old.reddit.com/r/tds_roblox/submit",
"exampleResult": "sh.reddit.com/r/tds_roblox/submit",
"error": null,
"includePattern": "[a-z]+?:\\/\\/.+?reddit.com\\/((r|u|user)\\/.+?\\/submit.*?$)",
"excludePattern": "",
"patternDesc": "",
"redirectUrl": "sh.reddit.com/$1",
"patternType": "R",
"processMatches": "noProcessing",
"disabled": false,
"grouped": false,
"appliesTo": [
"main_frame"
]
},
{
"description": "Old Reddit",
"exampleUrl": "https://www.reddit.com/r/reddit",
"exampleResult": "https://old.reddit.com/r/reddit",
"error": null,
"includePattern": "[a-z]+?:\\/\\/.*?\\.reddit\\.com\\/(((r|u|user)\\/.*)|$)",
"excludePattern": "[a-z]+?:\\/\\/.+?reddit.com\\/((r|u|user)\\/.+?\\/submit.*?$)",
"patternDesc": "",
"redirectUrl": "https://old.reddit.com/$1",
"patternType": "R",
"processMatches": "noProcessing",
"disabled": false,
"grouped": false,
"appliesTo": [
"main_frame"
]
}
]
}
top 3 comments
sorted by: hot top controversial new old
[–] kbal@fedia.io 1 points 2 weeks ago (1 children)

Dunno, but I'd start by removing the "?$" from your regexes unless there's a good reason not to. It's confusing to me and might be to the parser as well. There's also no need to escape the "/".

If the "?" is there because you're trying to require a literal ? in the url, you do need to escape that. But then it wouldn't normally make sense to have the $ immediately after it. "*?" isn't meaningful as a pattern quantity or whatever it's called: * already implies ?.

[–] TheTwelveYearOld@lemmy.world 1 points 2 weeks ago (1 children)

I changed the pattern to https://.+?reddit.com/((r|u|user)/.*?/submit.*$) and it still doesn't work.

[–] kbal@fedia.io 1 points 2 weeks ago

Ah well, at least that's easier to read. +? and *? are weird although I wouldn't expect them to break things in a way that matches what you see happening. They can both be replaced with just *. + means at least one, ? means zero or one, * means zero or more.