Open DVGRNN opened 7 years ago
Ok, small update. It seems to be caused by the ID that's generated by specifying more entropy at the end of the uniqid return value. But in that string there's always a non hex character, namely a .
When that . is present in the ID string, the viewer will not work, right mouse click on the link doesn't work, nothing happens. If I edit the string in MySQL and change the . into a regular number or letter, the functionality is restored for that file.
So is it possible to have the more entropy setting enabled, but that the . is not put in the string? Or is there a setting in Kloudspeaker somewhere that prevents the use of . in the item ID string (and can that be changed?)
Totally forgot about this issue, as it seems to be Windows specific.
Easy solution would be to replace all invalid chars with some safe ones in that itemidprovider, whenever it generates a new one. Ie something like this:
$id = strreplace(".", "", uniqid("", TRUE));
This would replace all "." with "_".
But I can't say if this is proper solution, for (at least) two reasons: 1) if uniqid itself can return "_", this solution might break the uniqueness. Ie the replacement char must be "safe" (does not break URLs) and something that the uniqid itself does not use. 2) if there are other chars like ".", then this would require some other approach
But if you are willing to try this, please let me know. I make a update that increases the entropy, but feedback from Windows user is welcome.
Actually, I made first version so that the dot is removed, ie
str_replace(".", "", uniqid("", TRUE));
This works at least in my development server, but unfortunately I don't have Windows server.
Next release will increase the id column to 32 chars, so that there is little room for different variations.
Created a new database and changed the $ID to str_replace(".", "", uniqid("", TRUE));
First tests are looking good. Added a folder with roughly 35000 PDF's. Started a search to fill the database with all files and only one error, but that was because of a script timeout, no messages about duplicate entries in php_error.log.
And yes, the viewing and downloading options are also working with this solution.
If I run into any more problems with this issue, I'll post it here., but for now I'm going to try and speed up the search results. Naturally searching through 35k files might take a while, but I think it can be quicker than 20-25 seconds.
Installation and configuring Kloudspeaker on a Windows server with MySQL went smoothly. Created users and folders contain PDF's. The plugin ViewerJS worked fine, but the zoom function didn't work and have switched to the Direct option. But while I was browsing the folders, I would occasionally get Request Failed errors, and they seemed to get worse.
A quick search for the error in the php_error.log gave me this possible solution:
https://groups.google.com/forum/#!topic/mollified/WlA_fTMkCVo
I have recreated the database and changed the MySQL ID from 13 to 23 characters and also edited the itemidprovider.class.php as mentioned there. And now, no more errors! :) But a new problem arose, the file viewer plugin doesn't work anymore. Nothing happens when I click on the files, no popup, no errors on screen or in the php log, just nothing. Tried ViewerJS, tried a Textfile with a .txt but nothing happens.
Any way to fix this?