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

Failing test: anchor lost in redirection #354

Closed
wants to merge 1 commit into from
Closed

Failing test: anchor lost in redirection #354

wants to merge 1 commit into from

Conversation

mro
Copy link

@mro mro commented Sep 18, 2015

@ArthurHoaro ArthurHoaro changed the title add a test for Failing test: anchor lost in redirection Sep 18, 2015
@ArthurHoaro
Copy link
Member

There are 2 issues here:

  • Anchor is lost while saving a new link because the referer points to do=addlink which we prevent. That's a bug.
  • Your tests are failing because generateLocation() doesn't accept relative URLs as referer. Should it though?

@mro
Copy link
Author

mro commented Sep 18, 2015

Anchor is lost while saving a new link because the referer points to do=addlink which we prevent.

can't follow. The referer doesn't mention do=addlink. However, I as well consider the new test to uncover an old bug.

Your tests are failing because generateLocation() doesn't accept relative URLs as referer. Should it though?

I think so. If I understand

Shaarli/index.php

Line 1358 in 38bedfb

$returnurl = ( !empty($_POST['returnurl']) ? escape($_POST['returnurl']) : '?' );
correctly, it's actually used with relative URLs.

I have no idea what generateLocation is supposed to precisely do, however. The comments are not enlightning.

@ArthurHoaro
Copy link
Member

can't follow. My test case doesn't mention do=addlink.

No, I was talking about a manual test: add a new link to see if I get the anchor back.

If I understand correctly, it's actually used with relative URLs.

$_POST['returnurl'] is set with HTTP referer which should be a full URL. But that part is a bit messy, I agree and I missed it in 775803a.

@mro
Copy link
Author

mro commented Sep 18, 2015

a manual test: add a new link to see if I get the anchor back.

done there: #308 (comment) (both manual and scripted)

$_POST['returnurl'] is set with HTTP referer

No, lin 1358 reads to me:

$returnurl = ( !empty($_POST['returnurl']) ? escape($_POST['returnurl']) : '?' );

so it is set either with the content of returnurl (which can be just anything) or ? which isn't an absolute url either.

Are we reading different code? Did you look at line 1358 mentioned above?

@mro
Copy link
Author

mro commented Sep 18, 2015

a side note: why does @virtualtam lock conversations like e.g. at #353 (comment) ?

@ArthurHoaro
Copy link
Member

Here. $returnurl is set to ? only if the referer is empty (which doesn't really make sense, I agree).

This thread is meant to be an "official" release thread, and is locked to be kept clean.

@mro
Copy link
Author

mro commented Sep 18, 2015

so after all the answer to "should it work with relative URLs" is IMO "yes", true?

doesn't really make sense

IMO it makes perfect sense - it was like this for years and worked fine.

clean

So where can I contribute to your comment #353 (comment) ?

@mro
Copy link
Author

mro commented Sep 18, 2015

(oh - and the HTTP_REFERER is unreliable and may contain about just anything sent by the HTTP-client, right?)

@ArthurHoaro
Copy link
Member

so after all the answer to "should it work with relative URLs" is IMO "yes", true?

Yes, probably.

So where can I contribute to your comment #353 (comment) ?

#308 if it's a general question, any specific issue thread (or create a new one) for specific matters.

(oh - and the HTTP_REFERER is unreliable and may contain about just anything sent by the browser, right?)

Yup. https://github.com/shaarli/Shaarli/wiki/Troubleshooting#redirection-issues-http-referer

@mro
Copy link
Author

mro commented Nov 8, 2015

@mro mro closed this Nov 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants