metacpan-api
metacpan-api copied to clipboard
error when browsing raw source
found / related to metacpan/metacpan-web#2564
point 1. is most likely a bug i think. for point 2. i'm not familiar enough with metacpan. i would have expected an overview of releases but this could just be as designed.
- browsing raw source without trailing slash
when browsing raw source, for example: https://fastapi.metacpan.org/source/RJBS/Dist-Zilla-6.023 it's very important that your link does not contain a trailing slash!
and using the "Parent Directory" link, you get returned to https://fastapi.metacpan.org/source/
and get the following error:
"message" : "Can't call method \"set_class\" on an undefined value at /home/metacpan/carton/metacpan-api/lib/perl5/ElasticSearchX/Model/Index.pm line 80.\n"
- browsing raw source with trailing slash
if your link does contain a trailing slash: https://fastapi.metacpan.org/source/RJBS/Dist-Zilla-6.023/
and you use the "Parent Directory" link, you get returned to https://fastapi.metacpan.org/source/RJBS/ and a:
{
"message" : "Not found",
"code" : 404
}
Has this now been fixed?
it doesn't seem so (metacpan/metacpan-web#2564 however is fixed).
just to be sure i tested with a newly uploaded release ( https://metacpan.org/dist/App-grep-url (0.002)) and https://metacpan.org/dist/Dist-Zilla like reported.
issues:
- still present
- still present but could be as designed?
- new but very related issue i found while doing tests to update this issue
i do think i narrowed down the issue for 1. & 3:
it seems when you are in the raw browser, on a location that is a directory, like
- https://fastapi.metacpan.org/source/PLICEASE/Alien-Build-2.41/lib/Alien/Build/Plugin/Extract
- https://fastapi.metacpan.org/source/RJBS/Dist-Zilla-6.023
and this directory does NOT contain a trailing slash, the "Parent Directory" link will move you up 2 directories.
if you add a trailing slash to this directory (like https://fastapi.metacpan.org/source/PLICEASE/Alien-Build-2.41/lib/Alien/Build/Plugin/Extract/) - make sure to reload the page after you do this - the "Parent Directory" link moves you up 1 directory as expected.
--
i don't want to make this report any more confusing - i think the 2 main issues are:
- no trailing slash moves you up 2 directories
- https://fastapi.metacpan.org/source gives http/500 when browsed to
--
- http 500 when parent dir does not end with a /
for issue 1. these are the request headers when using "Parent Directory" on https://fastapi.metacpan.org/source/RJBS/Dist-Zilla-6.023
GET /source/ HTTP/2
Host: fastapi.metacpan.org
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.8,nl-BE;q=0.5,nl;q=0.3
Accept-Encoding: gzip, deflate, br
Referer: https://fastapi.metacpan.org/source/RJBS/Dist-Zilla-6.023
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Pragma: no-cache
Cache-Control: no-cache
TE: Trailers
and the response headers
HTTP/2 500 Internal Server Error
server: nginx
content-type: application/json; charset=utf-8
cache-control: private
fastly-restarts: 1
accept-ranges: bytes
date: Sat, 10 Jul 2021 23:08:30 GMT
via: 1.1 varnish
x-served-by: cache-ams21055-AMS
x-cache: MISS
x-cache-hits: 0
x-timer: S1625958511.732069,VS0,VE129
content-length: 164
X-Firefox-Spdy: h2
with the response json
{
"message" : "Can't call method \"set_class\" on an undefined value at /home/metacpan/carton/metacpan-api/lib/perl5/ElasticSearchX/Model/Index.pm line 80.\n"
}
--
- http 404 when parent dir ends with a /
issue 2. (404 when using "Parent Directory" from a release containing an ending slash - https://fastapi.metacpan.org/source/RJBS/Dist-Zilla-6.023/ ) is also still present but could be as designed. when looking over the api code i didn't see anything to give a listing for /source of a particular user, nor is it mentioned in the api docs.
--
- use "Parent Directory" in the raw source browser while in a subdir of a distribution returns you up 2 directories.
both examples require
- using the raw browser
- not having a trailing / on your directory
- pressing the "Parent Directory" link
example 1 (no trailing / ) - incorrect: https://fastapi.metacpan.org/source/PLICEASE/Alien-Build-2.41/lib/Alien/Build/Plugin/Extract pressing "Parent Directory" moves you to https://fastapi.metacpan.org/source/PLICEASE/Alien-Build-2.41/lib/Alien/Build/ - 2 directories up.
example 2 (with trailing / ) - correct: https://fastapi.metacpan.org/source/PLICEASE/Alien-Build-2.41/lib/Alien/Build/Plugin/Extract/ pressing "Parent Directory" moves you to https://fastapi.metacpan.org/source/PLICEASE/Alien-Build-2.41/lib/Alien/Build/Plugin/ - 1 directory up.