Loading...
 
Skip to main content

uploading pdfs in file galleries fails when automatic indexing of file content is active

Status
Open
Subject
uploading pdfs in file galleries fails when automatic indexing of file content is active
Version
18.x Regression
Category
  • Bug
Feature
File Gallery (elFinder or standard UI)
Search
Resolution status
New
Submitted by
Jean-Marc Libs
Lastmod by
Jean-Marc Libs
Rating
(1)
Description

When Automatic indexing of file content is active, trying to upload pdf files fails.

The pdf file is still uploaded but the end user is told that upload failed.

Try uploading pdfs in http://nycdwight-11908-6600.show.tikiwiki.org/tiki-upload_file.php?galleryId=4 ! (beware of the 8MB size limit) (verify that Automatic indexing of file content is still active)

They display an error « File upload failed: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data ».
Only for pdfs.

This is an example return answer to /tiki-ajax_services.php?controller=file&action=upload_multiple :

<feff>{"files":
 Plugin Image
File not found.
%22},{%22size%22:15741,%22name%22:%22document_BBB_01_bresil.pdf%22,%22type%22:%22application\/pdf%22,%22fileId%22:%225789%22,%22galleryId%22:%22137%22,%22md5sum%22:%2250d71753a6487af8c023f28d8df58d24%22,%22info%22:{%22fileId%22:%225789%22,%22galleryId%22:%22137%22,%22name%22:%22Document BBB 01 Bresil%22,%22description%22:%22%22,%22created%22:%221554159196%22,%22filename%22:%22document_BBB_01_bresil.pdf%22,%22filesize%22:%2215741%22,%22filetype%22:%22application\/pdf%22,%22data%22:null,%22user%22:%22Jyhem%22,%22author%22:%22%22,%22hits%22:%220%22,%22maxhits%22:null,%22lastDownload%22:null,%22votes%22:null,%22points%22:null,%22path%22:%22c84d5b2eb5e278b26a0d60ab7bc4c606%22,%22reference_url%22:null,%22is_reference%22:null,%22hash%22:%2250d71753a6487af8c023f28d8df58d24%22,%22search_data%22:%22\n%22,%22metadata%22:%22%22,%22lastModif%22:%221554159196%22,%22lastModifUser%22:%22Jyhem%22,%22lockedby%22:%22%22,%22comment%22:%22%22,%22archiveId%22:%220%22,%22deleteAfter%22:null},%22syntax%22:%22 %22}" rel="">{%22size%22:15295,%22name%22:%22document_BBB_02_argentine.pdf%22,%22type%22:%22application\/pdf%22,%22fileId%22:%225788%22,%22galleryId%22:%22137%22,%22md5sum%22:%227a035db1d92779f8dcdefe083b292d94%22,%22info%22:{%22fileId%22:%225788%22,%22galleryId%22:%22137%22,%22name%22:%22Document BBB 02 Argentine%22,%22description%22:%22%22,%22created%22:%221554159196%22,%22filename%22:%22document_BBB_02_argentine.pdf%22,%22filesize%22:%2215295%22,%22filetype%22:%22application\/pdf%22,%22data%22:null,%22user%22:%22Jyhem%22,%22author%22:%22%22,%22hits%22:%220%22,%22maxhits%22:null,%22lastDownload%22:null,%22votes%22:null,%22points%22:null,%22path%22:%2290792de52961c34118f976ebe4af3a75%22,%22reference_url%22:null,%22is_reference%22:null,%22hash%22:%227a035db1d92779f8dcdefe083b292d94%22,%22search_data%22:%22\n%22,%22metadata%22:%22%22,%22lastModif%22:%221554159196%22,%22lastModifUser%22:%22Jyhem%22,%22lockedby%22:%22%22,%22comment%22:%22%22,%22archiveId%22:%220%22,%22deleteAfter%22:null},%22syntax%22:%22 %22},{%22size%22:15741,%22name%22:%22document_BBB_01_bresil.pdf%22,%22type%22:%22application\/pdf%22,%22fileId%22:%225789%22,%22galleryId%22:%22137%22,%22md5sum%22:%2250d71753a6487af8c023f28d8df58d24%22,%22info%22:{%22fileId%22:%225789%22,%22galleryId%22:%22137%22,%22name%22:%22Document BBB 01 Bresil%22,%22description%22:%22%22,%22created%22:%221554159196%22,%22filename%22:%22document_BBB_01_bresil.pdf%22,%22filesize%22:%2215741%22,%22filetype%22:%22application\/pdf%22,%22data%22:null,%22user%22:%22Jyhem%22,%22author%22:%22%22,%22hits%22:%220%22,%22maxhits%22:null,%22lastDownload%22:null,%22votes%22:null,%22points%22:null,%22path%22:%22c84d5b2eb5e278b26a0d60ab7bc4c606%22,%22reference_url%22:null,%22is_reference%22:null,%22hash%22:%2250d71753a6487af8c023f28d8df58d24%22,%22search_data%22:%22\n%22,%22metadata%22:%22%22,%22lastModif%22:%221554159196%22,%22lastModifUser%22:%22Jyhem%22,%22lockedby%22:%22%22,%22comment%22:%22%22,%22archiveId%22:%220%22,%22deleteAfter%22:null},%22syntax%22:%22 %22}}



The issue seems to be one or more invisible BOM (zero-length nonbreaking spaces) character before the json string.

My guess is, this regression is related to our changing the way pdfs are indexed. Since Tiki18, we use a php library bundled with Tiki. Before, we relied on a command line executable. Sadly, reverting to the old way of putting the following in tiki-admin.php?page=fgal#contentfgal_admin-5 does not work:

application/pdf: pdftotext -enc UTF-8 %1 -



Importance
8
Easy to solve?
5
Priority
40
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
7074
Created
Wednesday 08 May, 2019 17:58:31 UTC
by Jean-Marc Libs
LastModif
Friday 31 May, 2019 10:32:51 UTC


Show PHP error messages