Editor cant cannot download file from article

Editor cannot download file

If editor click lik article see this:

The rights to files and directories are correct, and the logs on the server do not show errors.

In log is only this: “GET /editor/downloadFile/848/1359/4 HTTP/1.1” 200 22529

If editor try download pdf file everything is ok, if autor try dowload file in pdf or doc everything is ok.
In the second journal this error in not exists.

Regards,

PS OJS version 2.4.7

Hi @lucien,

It looks like that file is somehow corrupted. Do you see anything like an error message at the beginning of the file? Can you PM me a link where I can download the file?

Regards,
Alec Smecher
Public Knowledge Project Team

When downloading a file via FTP, regardless if it is a version of SM or RV, the file is ok. It is not a single case. I have all the files uploaded by the authors. Journal manager, editors and section editors may not dowload file, only author owner this file can open it.

Hi @lucien,

Yes, my suspicion is that either whitespace is being accidentally introduced to the start of the file (via an accidental modification to a .php file), or that there’s an error message being included there. Do you see anything like an error message at the beginning of the file? Can you PM me a link where I can download the file?

Regards,
Alec Smecher
Public Knowledge Project Team

I have 3 magazines for OJS in the first everything is ok, and the other 2 are experiencing this error.
I checked the configuration of individual magazines and the rights to files and directories, and everywhere is the same.

Here is a copy of the OJS zz.uek.krakow.pl

Where i send configuration file ojs and php or login to copy OJS?

Hi @lucien,

What I need is a copy of the corrupted file. You can contact me privately by clicking my account and then hitting the “Message” button.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @lucien,

Thanks for the details. My guess was correct – there’s a single blank space being added to the top of the file, and that’s causing trouble.

The most likely cause for this is an accidental edit to one of the .inc.php classes in the Editor’s interface (probably in pages/editor/... or classes/submission/editor/... It can be as subtle as the beginning of the file looking like…

 <?php

…instead of…

<?php

(See the extra space?)

The best way to find this is to use a standard tool like diff to compare your installation to the stock version of OJS.

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks for help Alec
I find error in plugins/themes in my themes file.
This is extra space

Regards
Lucien

Dear, Lucien.
I have same problem now.
would you like to share how to solve it?

Regards
Adam

Hi @kharisma_adam
In OJS directory:
find . -name "*.inc.php" -type f -exec grep -il ' <?php' {} \;
and edit file with extra space before <?php and delete space.

Regards
Lucien

Hi @asmecher,

I have exactly the same problem on OJS 3. The downloaded .doc file is corrupted, while it works if FTP it manually form the server. In my case the problem is only with the reviews files (or at least found only there) uploaded under the review details.

I have checked with

find . -name “*.inc.php” -type f -exec grep -il ’ <?php’ {} ;

and the only files found are config.inc.php and template, that have

; <?php

at the beginning the file.

I have investigated it a bit more and the corrupted downloaded file has two empty lines at the beginning of the file. If I manually delete these two lines, than Word can open the file without any problem.

I have also checked and I can not find any +.inc.php file starting with two empty lines.

Can you please help me? Please let me know if I can send you the files or something to verify.

Actually I have found that the same problem appears also in some other places - that is downloaded document gets two additional emty lines at the beginning.

Best regards, Primož

Hi @primozs,

If you don’t see any blank spaces before the opening <?php tags, check for something after the closing ?> tags. (Note that we’ve removed these, starting with the forthcoming 3.1.2 release – but for OJS 3.1.1 and newer, they’re still present.)

I suspect you’ll find something accidentally added to your local files, so another way to find it would be to run a diff to compare your installation against a fresh copy from the .tar.gz distribution.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Hi @asmecher,

Thank you for your help. There were indeed some files with two empty lines at the end, after ?>. You are also right about me being accidentally cousing this when hacking in the files.

But it took me some time with searching for problematic files.

Thank you very much!

Best regards, Primož

Hi @primozs,

No problem, these can be tricky to find!

Regards,
Alec Smecher
Public Knowledge Project Team