[navigation] Bad Request with $conf['picture_url_style'] = 'id-file' #198

Open
opened 2026-10-04 23:46:54 +02:00 by adam · 5 comments
Owner

Reported by kubrick on 22 Aug 2012 22:57

Version: 2.4.3

If one specifies
$conf['picture_url_style'] = 'id-file';
in their configuration file, navigation is broken on some pictures, clicking on the image link in the category leads to "Bad Request".
This seems to happen only when the file name contains a certain combination of hyphens and spaces.

Steps to reproduce: Set $conf['picture_url_style'] = 'id-file';
Upload a file named "Killer Whale Type B - sort of.jpg" or "Cretin des bois test - pour rire.jpg"

Example of (mal)formed URL :
http://album.fgv6.net/picture.php?/34-Killer%20Whale%20Type%20B%20-%20sort%20of/category/4-on_the_rrs_ernest_shackleton

Additional information: Re-uploading the file on a different name fixes the problem.

Piwigo Bugtracker #2729

**Reported by kubrick on 22 Aug 2012 22:57** **Version:** 2.4.3 If one specifies $conf[&#039;picture_url_style&#039;] = &#039;id-file&#039;; in their configuration file, navigation is broken on some pictures, clicking on the image link in the category leads to &quot;Bad Request&quot;. This seems to happen only when the file name contains a certain combination of hyphens and spaces. **Steps to reproduce:** Set $conf[&#039;picture_url_style&#039;] = &#039;id-file&#039;; Upload a file named &quot;Killer Whale Type B - sort of.jpg&quot; or &quot;Cretin des bois test - pour rire.jpg&quot; Example of (mal)formed URL : http://album.fgv6.net/picture.php?/34-Killer%20Whale%20Type%20B%20-%20sort%20of/category/4-on_the_rrs_ernest_shackleton **Additional information:** Re-uploading the file on a different name fixes the problem. [Piwigo Bugtracker #2729](http://piwigo.org/bugs/view.php?id=2729) <!-- github-sync-id:97226442 -->
Author
Owner

Comment posted by kubrick on 26 Aug 2012 19:41

Adding
parse_str($_SERVER['QUERY_STRING'], $_GET);
at the top of include/common.inc.php fixes the problem.

Something must be tampering with the $_GET variable before it arrives there because in the problematic cases $_GET is empty.

**Comment posted by kubrick on 26 Aug 2012 19:41** Adding parse_str($_SERVER[&#039;QUERY_STRING&#039;], $_GET); at the top of include/common.inc.php fixes the problem. Something must be tampering with the $_GET variable before it arrives there because in the problematic cases $_GET is empty. <!-- github-comment-id:124892744 -->
Author
Owner

Comment posted by rvelices on 27 Aug 2012 18:46

sorry, I cannot reproduce (tried Killer Whale Type B - sort of with your url style and it works on my server)

**Comment posted by rvelices on 27 Aug 2012 18:46** sorry, I cannot reproduce (tried Killer Whale Type B - sort of with your url style and it works on my server) <!-- github-comment-id:124892759 -->
Author
Owner

Comment posted by kubrick on 28 Aug 2012 10:46

Ok, that's very odd. I made a fresh install on MAMP, and I can't reproduce either.

On my server, where the problem occurs, it's even odder:
If I create a new file in piwigo's directory, let's say test.php and just have it to print_r($_GET), when I call /test.php?/1-Killer Whale Type B - sort of/category/1-test
I get:

Array ( [/1-Killer_Whale_Type_B_-_sort_of/category/1-test] => )

Normal.

Now, it I do the same at the very top of picture.php, I get:

<!--Array
(
)
-->

Why??? Any ideas?

**Comment posted by kubrick on 28 Aug 2012 10:46** Ok, that&#039;s very odd. I made a fresh install on MAMP, and I can&#039;t reproduce either. On my server, where the problem occurs, it&#039;s even odder: If I create a new file in piwigo&#039;s directory, let&#039;s say test.php and just have it to print_r($_GET), when I call /test.php?/1-Killer Whale Type B - sort of/category/1-test I get: Array ( [/1-Killer_Whale_Type_B_-_sort_of/category/1-test] =&gt; ) Normal. Now, it I do the same at the very top of picture.php, I get: &lt;!--Array ( ) --&gt; Why??? Any ideas? <!-- github-comment-id:124892771 -->
Author
Owner

Comment posted by kubrick on 10 Jan 2014 12:21

FYI I'm still having this bug, and I still need the parse_str work around with the latest version of piwigo...

**Comment posted by kubrick on 10 Jan 2014 12:21** FYI I&#039;m still having this bug, and I still need the parse_str work around with the latest version of piwigo... <!-- github-comment-id:124892780 -->
Author
Owner

Comment posted by kubrick on 20 Nov 2014 07:57

Still happening in 2.7.1

**Comment posted by kubrick on 20 Nov 2014 07:57** Still happening in 2.7.1 <!-- github-comment-id:124892802 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#198