Page MenuHomePhabricator

Gallery image search not returning results when there is a pdf in the result set
Open, Needs TriagePublicBUG REPORT

Description

Steps to reproduce:

  • Upload images and pdf's with a similar name. eg (mycat.png, category.jpg, cat1.pdf)
  • Edit Page
  • Insert Gallery
  • Enter a term in the search box that matches a known image name and a known pdf filename. eg. cat

Expected result:

  • 2 results with thumbnails for mycat.png and category.jpg

Actual Result:

No results returned
Ajax result contains message like 'Could not normalize image parameters for cat1.pdf'

If I change the search query to:

-filemime:pdf cat

I get results correctly.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Hi @Jandrews377, thanks for taking the time to report this and welcome to Wikimedia Phabricator! Which software version is this about?

Hi @Aklapper. Thanks for taking the time to reply. Our Versions:

  • mediawiki 1.34
  • thenets/parsoid:0.11
  • pastakhov/restbase:0.16.9
  • elasticsearch:6.5.4

All of the modules are using the 1.34 branch:

  • Echo
  • NoTitle
  • Spoilers
  • Thanks
  • CheckUser
  • Math
  • ExternalData
  • Flow
  • UploadWizard
  • Babel
  • cldr
  • CleanChanges
  • UniversalLanguageSelector
  • VisualEditor
  • CirrusSearch
  • Elastica
  • PDFEmbed

Could not normalize image parameters for ... is the message apierror-urlparamnormal. In a quick review this looks to only be emitted by ApiQueryImageInfo.

If you try and get the image info without search, does it also error? An example api request would be something like the following, but replace the title with a local pdf. This may depend on a very specific pdf being returned, rather than any arbitrary one, hard to say.

https://commons.wikimedia.org/w/api.php?action=query&format=json&prop=imageinfo&titles=File%3AAlmanac_Kievlyanin_(book_2%2C_1841).pdf

Hi EBernhardson,

Using your query, I don't get an error.
However, using the query the gallery generates for its ajax request, I get the error:

/api.php?action=query&format=json&generator=search&gsrnamespace=6&iiurlheight=200&iiprop=dimensions%7Curl%7Cmediatype%7Cextmetadata%7Ctimestamp%7Cuser&prop=imageinfo&gsrsearch=TruTrack&iiurlwidth=300&gsroffset=0&gsrlimit=15

If I manipulate the request and remove the iiurlheight and iiurlwidth parameters, I am able to get a response, without issue.
It looks like the backend may be having trouble generating thumbnaisl for pdf's ? Unfortunately I dont see any errors.

Many thanks.

@ssastry , this looks like it may be less of a search issue and more related to the pdf handler

@MPhamWMF the PDF handler we maintain might not be related because it's a nodejs service that generates PDF on the fly for the requested wiki page and it doesn't handle uploaded PDF files.

I'm assuming this has to do with Wikibase and not the PDF handler, unless I'm missing something.

I have the exact same problem here.. Any update?

All updates are in this ticket.

Sorry, I am new here. Is there a solution to this problem?

Hi, unfortunately there isn't currently... This ticket is still open and anyone is welcome to investigate and work on a solution. :)

In my case, I removed the PdfHandler extension and it worked just fine.