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

404 error after deleting a link from it's own page #87

Closed
e2jk opened this issue Dec 29, 2014 · 6 comments
Closed

404 error after deleting a link from it's own page #87

e2jk opened this issue Dec 29, 2014 · 6 comments
Labels
bug it's broken! please test

Comments

@e2jk
Copy link

e2jk commented Dec 29, 2014

How to reproduce:

  • Go to a link's own page (permalink)
  • Delete the link
  • You are returned to same page, but this time with a 404 error (as the link doesn't exist anymore)

Suggested fix:
If the url to be returned to is going to be a permalink, redirect instead to the home page.

@e2jk
Copy link
Author

e2jk commented Dec 29, 2014

The code to be altered is around line 1551 in index.php in the current master

$returnurl = ( isset($_POST['returnurl']) ? $_POST['returnurl'] : '?' );
if ($returnurl=='?') { $returnurl = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '?'); }
header('Location: '.$returnurl); // After deleting the link, redirect to the page the user was on.

@e2jk e2jk added the bug it's broken! label Dec 29, 2014
@pikzen
Copy link

pikzen commented Jan 1, 2015

The easiest (and most logical) fix would be redirecting to / once the link has been deleted.

However, the current case handles passing around a redirect url to a ?do= page. Aside from being almost never used (Deleting a link from another page on another website ?), HTTP_REFERER is set differently on each browser and is almost always set to the previous page.
Opinions on removing all this referer parsing nonsense and just ALWAYS returning to / ?

@e2jk
Copy link
Author

e2jk commented Jan 2, 2015

I think it is OK to just redirect to Shaarli's home page.
This would only be an issue when you want to delete multiple links from e.g. a search, but (1) how often does this use case happen and (2) you could click twice on the back button and you would be back to the page from which you clicked the delete button.

@e2jk
Copy link
Author

e2jk commented Jan 4, 2015

I've created pull request #90 that redirects to ? (the default when returnurlor HTTP_REFERER were empty). Please review, test and merge.

@nodiscc
Copy link
Member

nodiscc commented Jan 5, 2015

Fixed in #90

@nodiscc nodiscc closed this as completed Jan 5, 2015
@nodiscc
Copy link
Member

nodiscc commented Feb 14, 2015

@e2jk I frequently hit this bug:

This would only be an issue when you want to delete multiple links from e.g. a search, but (1) how often does this use case happen and (2) you could click twice on the back button and you would be back to the page from which you clicked the delete button.

It's very annoying when you are trying to cleanup links with a certain tag. I think if either $searchtags or $searchterm are defined, we should add these params to the next request (so you would be redirected to the previous serach. Hitting back twice is confusing and annoying.

I'll aopen another issue for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug it's broken! please test
Projects
None yet
Development

No branches or pull requests

3 participants