Sheezy-Art / sheezy-hub

Public repo to discuss issues and feature requests
https://sheezy.art/
13 stars 0 forks source link

[BUG] Outgoing anchor links don't work properly #507

Open mariteaux opened 8 months ago

mariteaux commented 8 months ago

Describe the Issue In HTML, you can set an anchor at the end of a URL to skip to a certain section on the page you're linking to. These look like #[page_id]. Sheezy will accept these links and keep the anchor in the URL, but when you click on them, the outgoing link warning page scrubs the anchor and sends you to the page without it. I can't tell if this is intended behavior or not.

To Reproduce

  1. Set an outgoing link in a description or bio to have an ID anchor. You can use one of my submissions as an example. The link with the text "what was up on there was drawn in fall 2022" links to my personal site, and is supposed to link to http://home.macintosh.garden/~mariteaux/art/2022/summer/#th_cammy.
  2. Click the link. Sheezy's warning page will give the URL as http://home.macintosh.garden/~mariteaux/art/2022/summer/, without the anchor at the end. The address bar still features the anchor, but the page text does not.
  3. You'll be redirected to the page, but it won't skip to the anchored section.

Expected Behaviour Ideally, skipping to the anchored section of the page. If these aren't supported, Sheezy should filter these when you make the link and that should be noted somewhere.

Device

mariteaux commented 8 months ago

Trying it again and now it seems to be working. I'll leave it open in case anyone can reproduce and it can get closed if not.

xnyoom commented 8 months ago

So it does seem to redirect with the anchor (at least for me). But based on my understanding of anchors, this shouldn't actually work at all, and as such may be inconsistent between browsers.

This is very strange.

I'll need to research browser behavior regarding redirects and anchors later today.

boylett commented 8 months ago

Sheezy does its URL scanning server-side, and then passes a "confirmed safe" version of the URL back to the frontend for the eventual redirect. Unfortunately, URL hashes don't get sent to the server, so the hash gets lost - the site attempts to suffix the hash in the browser but it isn't always successful. Am of course open to changing this behaviour.