pwg.images.add returns a plain text error, regardless of requested format #429

Open
opened 2026-10-04 23:58:02 +02:00 by adam · 0 comments
Owner

An attempt to upload an unsupported file format produces a plain text error, even though JSON was requested.

REQUEST:

POST http://piwigo28.int/ws.php?method=pwg.images.add&format=json HTTP/1.1
Accept: */*
Cookie: pwg_id=1p64dj3gpn9jap5j03lk59f2e3
Content-Type: application/x-www-form-urlencoded
Content-Length: 261
User-Agent: Adobe Photoshop Lightroom
Host: piwigo28.int
Pragma: no-cache

categories=2&file_sum=dbdae213bd98acaade001d2cb582827d&comment=&author=&tag_ids=1&pwg_token=4f9a19ce4c47487f45e65d816c715553&name=&original_sum=dbdae213bd98acaade001d2cb582827d&date_creation=2014-09-01%2022%3A49%3A37&level=0&resize=0&original_filename=-9035.mp4

RESPONSE:

HTTP/1.1 200 OK
Date: Sun, 03 Apr 2016 17:49:28 GMT
Server: Apache/2.2.22 (Win32) mod_ssl/2.2.22 OpenSSL/0.9.8t PHP/5.3.29
X-Powered-By: PHP/5.3.29
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 19
Content-Type: text/html; charset=utf-8

forbidden file type

Tested with Piwigo 2.5 and 2.8.0.
It looks like instead of die() all errors must be raised via "new PwgError(...)"

An attempt to upload an unsupported file format produces a plain text error, even though JSON was requested. ``` REQUEST: POST http://piwigo28.int/ws.php?method=pwg.images.add&format=json HTTP/1.1 Accept: */* Cookie: pwg_id=1p64dj3gpn9jap5j03lk59f2e3 Content-Type: application/x-www-form-urlencoded Content-Length: 261 User-Agent: Adobe Photoshop Lightroom Host: piwigo28.int Pragma: no-cache categories=2&file_sum=dbdae213bd98acaade001d2cb582827d&comment=&author=&tag_ids=1&pwg_token=4f9a19ce4c47487f45e65d816c715553&name=&original_sum=dbdae213bd98acaade001d2cb582827d&date_creation=2014-09-01%2022%3A49%3A37&level=0&resize=0&original_filename=-9035.mp4 RESPONSE: HTTP/1.1 200 OK Date: Sun, 03 Apr 2016 17:49:28 GMT Server: Apache/2.2.22 (Win32) mod_ssl/2.2.22 OpenSSL/0.9.8t PHP/5.3.29 X-Powered-By: PHP/5.3.29 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Length: 19 Content-Type: text/html; charset=utf-8 forbidden file type ``` Tested with Piwigo 2.5 and 2.8.0. It looks like instead of die() all errors must be raised via "new PwgError(...)" <!-- github-sync-id:145523364 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#429