[GH-ISSUE #108] Unsupported filetype for valid image using geturl.php #83

Closed
opened 2026-02-25 23:40:37 +03:00 by kerem · 8 comments
Owner
Originally created by @dessalines on GitHub (Feb 27, 2020). Original GitHub issue: https://github.com/HaschekSolutions/pictshare/issues/108 Could you help me test this seemingly valid image with geturl.php? https://MY_PICTSHARE.com/pictshare/api/geturl.php?url=https://i.guim.co.uk/img/media/4d908693e566fdd7f8cdeac559f6375b739887a3/356_37_3264_1958/master/3264.jpg?width=1200&height=630&quality=85&auto=format&fit=crop&overlay-align=bottom%2Cleft&overlay-width=100p&overlay-base64=L2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc&enable=upscale&s=3a70177dcc60673c606302d96fcbd9bc Error: ``` filetype: "x-empty" reason: "Unsupported filetype" status: "err" ``` ​
kerem closed this issue 2026-02-25 23:40:37 +03:00
Author
Owner

@geek-at commented on GitHub (Feb 27, 2020):

are you using the docker container or did you install it yourself?

If it's the latter it looks like you're missing some libraries.. does the server have the file command?

<!-- gh-comment-id:592237373 --> @geek-at commented on GitHub (Feb 27, 2020): are you using the docker container or did you install it yourself? If it's the latter it looks like you're missing some libraries.. does the server have the `file` command?
Author
Owner

@dessalines commented on GitHub (Feb 28, 2020):

Its using shtripok's docker (necessary for arm compatibility too I think). My docker-compose.yml section:

  pictshare:
    image: shtripok/pictshare:latest
    ports:
      - "127.0.0.1:8537:80"
    volumes:
      - pictshare:/usr/share/nginx/html/data
    restart: always

Did you test this one out?

edit: I also forgot to mention, that most urls work, its just some don't.

<!-- gh-comment-id:592279020 --> @dessalines commented on GitHub (Feb 28, 2020): Its using shtripok's docker (necessary for arm compatibility too I think). My `docker-compose.yml` section: ``` pictshare: image: shtripok/pictshare:latest ports: - "127.0.0.1:8537:80" volumes: - pictshare:/usr/share/nginx/html/data restart: always ``` Did you test this one out? edit: I also forgot to mention, that most urls work, its just some don't.
Author
Owner

@geek-at commented on GitHub (Feb 28, 2020):

Actually the latest official docker images detect the architecture and should work on ARM without a problem

But it seems that the site you're using is checking some sessions or something because when I open your image in the browser it works

But when I download it with curl

curl "https://i.guim.co.uk/img/media/4d908693e566fdd7f8cdeac559f6375b739887a3/356_37_3264_1958/master/3264.jpg?width=1200&height=630&quality=85&auto=format&fit=crop&overlay-align=bottom%2Cleft&overlay-width=100p&overlay-base64=L2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc&enable=upscale&s=3a70177dcc60673c606302d96fcbd9bc"

It's answering with

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>401 Unauthorized - missing signature</title>
  </head>
  <body>
    <h1>Error 401 Unauthorized - missing signature</h1>
    <p>Unauthorized - missing signature</p>
    <h3>Guru Mediation:</h3>
    <p>Details: cache-vie21641-VIE 1582891201 3100362804</p>
    <hr>
    <p>Varnish cache server</p>
  </body>
</html>

So it's not a problem with Pictshare, it's the caching server that required some headers probably

<!-- gh-comment-id:592483598 --> @geek-at commented on GitHub (Feb 28, 2020): Actually the latest official docker images detect the architecture and should work on ARM without a problem But it seems that the site you're using is checking some sessions or something because when I open [your image](https://i.guim.co.uk/img/media/4d908693e566fdd7f8cdeac559f6375b739887a3/356_37_3264_1958/master/3264.jpg?width=1200&height=630&quality=85&auto=format&fit=crop&overlay-align=bottom%2Cleft&overlay-width=100p&overlay-base64=L2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc&enable=upscale&s=3a70177dcc60673c606302d96fcbd9bc) in the browser it works But when I download it with curl curl "https://i.guim.co.uk/img/media/4d908693e566fdd7f8cdeac559f6375b739887a3/356_37_3264_1958/master/3264.jpg?width=1200&height=630&quality=85&auto=format&fit=crop&overlay-align=bottom%2Cleft&overlay-width=100p&overlay-base64=L2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc&enable=upscale&s=3a70177dcc60673c606302d96fcbd9bc" It's answering with ```html <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>401 Unauthorized - missing signature</title> </head> <body> <h1>Error 401 Unauthorized - missing signature</h1> <p>Unauthorized - missing signature</p> <h3>Guru Mediation:</h3> <p>Details: cache-vie21641-VIE 1582891201 3100362804</p> <hr> <p>Varnish cache server</p> </body> </html> ``` So it's not a problem with Pictshare, it's the caching server that required some headers probably
Author
Owner

@dessalines commented on GitHub (Feb 28, 2020):

Hrm this is strange... when I run that exact same curl command on my local machine, it does download the picture fine. What curl you on?

curl --version
curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1d zlib/1.2.11 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh2/1.9.0 nghttp2/1.39.2
<!-- gh-comment-id:592528099 --> @dessalines commented on GitHub (Feb 28, 2020): Hrm this is strange... when I run that exact same curl command on my local machine, it does download the picture fine. What curl you on? ``` curl --version curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1d zlib/1.2.11 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh2/1.9.0 nghttp2/1.39.2 ```
Author
Owner

@geek-at commented on GitHub (Feb 28, 2020):

Sorry I copied the link after I put it in my browser.

when you curl with the original link you posted

curl "https://i.guim.co.uk/img/media/4d908693e566fdd7f8cdeac559f6375b739887a3/356_37_3264_1958/master/3264.jpg\?width\=1200\&height\=630\&quality\=85\&auto\=format\&fit\=crop\&overlay-align\=bottom%2Cleft\&overlay-width\=100p\&overlay-base64\=L2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc\&enable\=upscale\&s\=3a70177dcc60673c606302d96fcbd9bc"

You'll get the error. It seems one of the variables attached to the image is a session ID that's not available for long

<!-- gh-comment-id:592661517 --> @geek-at commented on GitHub (Feb 28, 2020): Sorry I copied the link after I put it in my browser. when you curl with the original link you posted `curl "https://i.guim.co.uk/img/media/4d908693e566fdd7f8cdeac559f6375b739887a3/356_37_3264_1958/master/3264.jpg\?width\=1200\&height\=630\&quality\=85\&auto\=format\&fit\=crop\&overlay-align\=bottom%2Cleft\&overlay-width\=100p\&overlay-base64\=L2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc\&enable\=upscale\&s\=3a70177dcc60673c606302d96fcbd9bc"` You'll get the error. It seems one of the variables attached to the image is a session ID that's not available for long
Author
Owner

@dessalines commented on GitHub (Feb 28, 2020):

That one is different than the link I posted at the top, it seems to have a lot of extra slashes.

This command is correctly downloading the image: curl "https://i.guim.co.uk/img/media/4d908693e566fdd7f8cdeac559f6375b739887a3/356_37_3264_1958/master/3264.jpg?width=1200&height=630&quality=85&auto=format&fit=crop&overlay-align=bottom%2Cleft&overlay-width=100p&overlay-base64=L2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc&enable=upscale&s=3a70177dcc60673c606302d96fcbd9bc" -o test_img

<!-- gh-comment-id:592665761 --> @dessalines commented on GitHub (Feb 28, 2020): That one is different than the link I posted at the top, it seems to have a lot of extra slashes. This command is correctly downloading the image: ` curl "https://i.guim.co.uk/img/media/4d908693e566fdd7f8cdeac559f6375b739887a3/356_37_3264_1958/master/3264.jpg?width=1200&height=630&quality=85&auto=format&fit=crop&overlay-align=bottom%2Cleft&overlay-width=100p&overlay-base64=L2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc&enable=upscale&s=3a70177dcc60673c606302d96fcbd9bc" -o test_img`
Author
Owner

@geek-at commented on GitHub (Mar 6, 2020):

Did you rawurlencode the URL before attaching it to https://MY_PICTSHARE.com/pictshare/api/geturl.php?url= ? because that url has "&" and "?" in it so if you use

https://MY_PICTSHARE.com/pictshare/api/geturl.php?url=https://i.guim.co.uk/img/media/4d908693e566fdd7f8cdeac559f6375b739887a3/356_37_3264_1958/master/3264.jpg?width=1200&height=630&quality=85&auto=format&fit=crop&overlay-align=bottom%2Cleft&overlay-width=100p&overlay-base64=L2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc&enable=upscale&s=3a70177dcc60673c606302d96fcbd9bc

Pictshare would only see url=https://i.guim.co.uk/img/media/4d908693e566fdd7f8cdeac559f6375b739887a3/356_37_3264_1958/master/3264.jpg which will return an invalid image.

if you rawurlencode it to https%3A%2F%2Fi.guim.co.uk%2Fimg%2Fmedia%2F4d908693e566fdd7f8cdeac559f6375b739887a3%2F356_37_3264_1958%2Fmaster%2F3264.jpg%3Fwidth%3D1200%26height%3D630%26quality%3D85%26auto%3Dformat%26fit%3Dcrop%26overlay-align%3Dbottom%252Cleft%26overlay-width%3D100p%26overlay-base64%3DL2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc%26enable%3Dupscale%26s%3D3a70177dcc60673c606302d96fcbd9bc

and attach it encoded to the api, it works on my end

https://MY_PICTSHARE.com/pictshare/api/geturl.php?url=https%3A%2F%2Fi.guim.co.uk%2Fimg%2Fmedia%2F4d908693e566fdd7f8cdeac559f6375b739887a3%2F356_37_3264_1958%2Fmaster%2F3264.jpg%3Fwidth%3D1200%26height%3D630%26quality%3D85%26auto%3Dformat%26fit%3Dcrop%26overlay-align%3Dbottom%252Cleft%26overlay-width%3D100p%26overlay-base64%3DL2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc%26enable%3Dupscale%26s%3D3a70177dcc60673c606302d96fcbd9bc

returns

{
  "status": "ok",
  "hash": "o5x75s.jpg",
  "url": "https://pictshare.net/o5x75s.jpg",
  "filetype": "jpeg",
  "delete_code": "z11o0dyzgwdg6oqz08zrx4h18d0vvw",
  "delete_url": "https://pictshare.net/delete_z11yzgwdg6oqz08zigrx4h18d0vvw/o5x75s.jpg"
}
<!-- gh-comment-id:595979941 --> @geek-at commented on GitHub (Mar 6, 2020): Did you rawurlencode the URL before attaching it to `https://MY_PICTSHARE.com/pictshare/api/geturl.php?url=` ? because that url has "&" and "?" in it so if you use ``` https://MY_PICTSHARE.com/pictshare/api/geturl.php?url=https://i.guim.co.uk/img/media/4d908693e566fdd7f8cdeac559f6375b739887a3/356_37_3264_1958/master/3264.jpg?width=1200&height=630&quality=85&auto=format&fit=crop&overlay-align=bottom%2Cleft&overlay-width=100p&overlay-base64=L2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc&enable=upscale&s=3a70177dcc60673c606302d96fcbd9bc ``` Pictshare would only see `url=https://i.guim.co.uk/img/media/4d908693e566fdd7f8cdeac559f6375b739887a3/356_37_3264_1958/master/3264.jpg` which will return an invalid image. if you rawurlencode it to `https%3A%2F%2Fi.guim.co.uk%2Fimg%2Fmedia%2F4d908693e566fdd7f8cdeac559f6375b739887a3%2F356_37_3264_1958%2Fmaster%2F3264.jpg%3Fwidth%3D1200%26height%3D630%26quality%3D85%26auto%3Dformat%26fit%3Dcrop%26overlay-align%3Dbottom%252Cleft%26overlay-width%3D100p%26overlay-base64%3DL2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc%26enable%3Dupscale%26s%3D3a70177dcc60673c606302d96fcbd9bc` and attach it encoded to the api, it works on my end ``` https://MY_PICTSHARE.com/pictshare/api/geturl.php?url=https%3A%2F%2Fi.guim.co.uk%2Fimg%2Fmedia%2F4d908693e566fdd7f8cdeac559f6375b739887a3%2F356_37_3264_1958%2Fmaster%2F3264.jpg%3Fwidth%3D1200%26height%3D630%26quality%3D85%26auto%3Dformat%26fit%3Dcrop%26overlay-align%3Dbottom%252Cleft%26overlay-width%3D100p%26overlay-base64%3DL2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc%26enable%3Dupscale%26s%3D3a70177dcc60673c606302d96fcbd9bc ``` returns ```json { "status": "ok", "hash": "o5x75s.jpg", "url": "https://pictshare.net/o5x75s.jpg", "filetype": "jpeg", "delete_code": "z11o0dyzgwdg6oqz08zrx4h18d0vvw", "delete_url": "https://pictshare.net/delete_z11yzgwdg6oqz08zigrx4h18d0vvw/o5x75s.jpg" } ```
Author
Owner

@dessalines commented on GitHub (Mar 7, 2020):

That did it, thanks!

<!-- gh-comment-id:596136989 --> @dessalines commented on GitHub (Mar 7, 2020): That did it, thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/pictshare#83
No description provided.