pwg.images.addSimple fails when supplying tags #1808

Open
opened 2026-10-05 00:57:21 +02:00 by adam · 7 comments
Owner

I have a weird issue where a call to pwg.images.addSimple fails when the image in question is added with the tags parameter present.

Piwigo is 14.1.0
Apache2 2.4.57-2
php 8.2

on Debian Bookworm.

I am pretty sure this used to work, but since I upgraded Piwigo and PHP I cannot tell you which of the two might have broken it.
There is of course also a small chance that I am doing something weird in Shotwell's upload code.

Failure mode is either a 501 Missing "method" name if the tags are hierarchical (eg. "/foo/bar/baz") or a 401 Access denied if its just plain tags.

Working form data:

> Host: jensge.org
> 
> --588d05a9fcd087d51198ec360f1ba1b725c79def406bf6a2e745877851d0b96f
> Content-Disposition: form-data; name="name"
> 
> DCIM_00001_1.png
> --588d05a9fcd087d51198ec360f1ba1b725c79def406bf6a2e745877851d0b96f
> Content-Disposition: form-data; name="method"
> 
> pwg.images.addSimple
> --588d05a9fcd087d51198ec360f1ba1b725c79def406bf6a2e745877851d0b96f
> Content-Disposition: form-data; name="category"
> 
> 6
> --588d05a9fcd087d51198ec360f1ba1b725c79def406bf6a2e745877851d0b96f
> Content-Disposition: form-data; name="level"
> 
> 8
> --588d05a9fcd087d51198ec360f1ba1b725c79def406bf6a2e745877851d0b96f
> Content-Type: image/jpeg
> Content-Disposition: form-data; filename=DCIM_00001_1.png.jpg; name=image
> 
> ����

Non-working form data, resulting in "401 Access denied" error:

> Host: jensge.org
> 
> --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2
> Content-Disposition: form-data; name="name"
> 
> IMG_0059.JPG
> --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2
> Content-Disposition: form-data; name="method"
> 
> pwg.images.addSimple
> --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2
> Content-Disposition: form-data; name="category"
> 
> 6
> --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2
> Content-Disposition: form-data; name="level"
> 
> 8
> --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2
> Content-Disposition: form-data; name="tags"
> 
> Hamburg,Wandern
> --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2
> Content-Type: image/jpeg
> Content-Disposition: form-data; filename=IMG_0059.JPG; name=image
> 
> ����
  
I have a weird issue where a call to pwg.images.addSimple fails when the image in question is added with the tags parameter present. Piwigo is 14.1.0 Apache2 2.4.57-2 php 8.2 on Debian Bookworm. I am pretty sure this used to work, but since I upgraded Piwigo and PHP I cannot tell you which of the two might have broken it. There is of course also a small chance that I am doing something weird in Shotwell's upload code. Failure mode is either a 501 Missing "method" name if the tags are hierarchical (eg. "/foo/bar/baz") or a 401 Access denied if its just plain tags. Working form data: ``` > Host: jensge.org > > --588d05a9fcd087d51198ec360f1ba1b725c79def406bf6a2e745877851d0b96f > Content-Disposition: form-data; name="name" > > DCIM_00001_1.png > --588d05a9fcd087d51198ec360f1ba1b725c79def406bf6a2e745877851d0b96f > Content-Disposition: form-data; name="method" > > pwg.images.addSimple > --588d05a9fcd087d51198ec360f1ba1b725c79def406bf6a2e745877851d0b96f > Content-Disposition: form-data; name="category" > > 6 > --588d05a9fcd087d51198ec360f1ba1b725c79def406bf6a2e745877851d0b96f > Content-Disposition: form-data; name="level" > > 8 > --588d05a9fcd087d51198ec360f1ba1b725c79def406bf6a2e745877851d0b96f > Content-Type: image/jpeg > Content-Disposition: form-data; filename=DCIM_00001_1.png.jpg; name=image > > ���� ``` Non-working form data, resulting in "401 Access denied" error: ``` > Host: jensge.org > > --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2 > Content-Disposition: form-data; name="name" > > IMG_0059.JPG > --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2 > Content-Disposition: form-data; name="method" > > pwg.images.addSimple > --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2 > Content-Disposition: form-data; name="category" > > 6 > --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2 > Content-Disposition: form-data; name="level" > > 8 > --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2 > Content-Disposition: form-data; name="tags" > > Hamburg,Wandern > --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2 > Content-Type: image/jpeg > Content-Disposition: form-data; filename=IMG_0059.JPG; name=image > > ���� ``` <!-- github-sync-id:2061524184 -->
Author
Owner

Form data resulting in Missing "method" name

> Host: jensge.org
> 
> --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2
> Content-Disposition: form-data; name="name"
> 
> IMG_0059.JPG
> --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2
> Content-Disposition: form-data; name="method"
> 
> pwg.images.addSimple
> --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2
> Content-Disposition: form-data; name="category"
> 
> 6
> --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2
> Content-Disposition: form-data; name="level"
> 
> 8
> --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2
> Content-Disposition: form-data; name="tags"
> 
> /Hamburg,/Hamburg/Sport,/Hamburg/Sport/Wandern
> --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2
> Content-Type: image/jpeg
> Content-Disposition: form-data; filename=IMG_0059.JPG; name=image
> 
> ����
Form data resulting in Missing "method" name ``` > Host: jensge.org > > --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2 > Content-Disposition: form-data; name="name" > > IMG_0059.JPG > --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2 > Content-Disposition: form-data; name="method" > > pwg.images.addSimple > --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2 > Content-Disposition: form-data; name="category" > > 6 > --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2 > Content-Disposition: form-data; name="level" > > 8 > --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2 > Content-Disposition: form-data; name="tags" > > /Hamburg,/Hamburg/Sport,/Hamburg/Sport/Wandern > --cc6dd8138b0a340f9f29a319659f3fac31ef95b4301f83b39253b76fb254d8d2 > Content-Type: image/jpeg > Content-Disposition: form-data; filename=IMG_0059.JPG; name=image > > ���� ``` <!-- github-comment-id:1873302399 -->
Author
Owner

Its a bit weirder. If the first thing you upload has the second post format, only then another post with "normal tags" included will fail - even if it worked before

Its a bit weirder. If the first thing you upload has the second post format, only then another post with "normal tags" included will fail - even if it worked before <!-- github-comment-id:1875981226 -->
Author
Owner

Ok, this is probably not a bug but a config issue, trying to upload files that exceed upload_max_filesize/post_max_size - a nicer error message would be helpful, though

Ok, this is probably not a bug but a config issue, trying to upload files that exceed upload_max_filesize/post_max_size - a nicer error message would be helpful, though <!-- github-comment-id:1876005360 -->
Author
Owner

Doesn't this:
https://github.com/Piwigo/Piwigo/issues/1720#issuecomment-1253714154
Appear to have resolved the max_filesize issue?

Doesn't this: https://github.com/Piwigo/Piwigo/issues/1720#issuecomment-1253714154 Appear to have resolved the max_filesize issue? <!-- github-comment-id:1907131509 -->
Author
Owner

Ok, this is probably not a bug but a config issue, trying to upload files that exceed upload_max_filesize/post_max_size - a nicer error message would be helpful, though

So, this is not a tags problem at all?

> Ok, this is probably not a bug but a config issue, trying to upload files that exceed upload_max_filesize/post_max_size - a nicer error message would be helpful, though So, this is not a tags problem at all? <!-- github-comment-id:1907132079 -->
Author
Owner

Maybe. But there is definitely different behavior depending on the type of tag there, which is also weird

Maybe. But there is definitely different behavior depending on the type of tag there, which is also weird <!-- github-comment-id:1907711628 -->
Author
Owner

I'm testing with nginx instead of apache but on Debian 12 as well. It works fine but I indeed have to adjust /etc/php/8.2/fpm/php.ini to increase values for post_max_size and upload_max_filesize

I'm testing with nginx instead of apache but on Debian 12 as well. It works fine but I indeed have to adjust `/etc/php/8.2/fpm/php.ini` to increase values for `post_max_size` and `upload_max_filesize` <!-- github-comment-id:1908262393 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#1808