Cannot log in - javascript truncated

Nextcloud version:
Operating system and version: Cinnamon Minut 18.3
Apache or nginx version: nginx/1.10.3
PHP version: 7.0.30-0ubuntu0.16.04.1

I have a problem logging in on the web interface. (The client software is all working fine.) I could not find any useful information in the NGINX logs or in the Nextcloud log. I looked at the Web Console in Firefox. There were several errors, but the first and most serious one was this:

SyntaxError: expected expression, got end of script[Learn More] merged-template-prepend.js:5131:33

I used “wget” to fetch the file. The original file is found under the “datadirectory” and has a length of 148342 bytes. It is complete. The file I fetch with “wget” always has a length of 144019. Similarly, the file “merged-share-backend.js” is also truncated but at a different length. I copied the JS file to a different virtual host. NGINX is able to serve the whole file without any problem. Of course, in this case the file is being served directly and not going through PHP.

I know that PHP has configurations for uploading files, but I never heard of any restriction downloading. Or could it be some kind of cache problem?

Thanks in advance for any help.

I would disable any plugins and try again or try a different browser.

For anyone who encounters the same problem, I fixed it by upgrading to (using the manual upgrade instructions). I had considered doing this before, but I didn’t want to compound my problems by doing an upgrade before it was fixed. I don’t expect there was anything in the newer version that fixed it, rather it was the process of upgrading itself.

So I looked in the table oc_filecache for the truncated file. My guess was that the file was not being served from the datadirectory, but from the database. In fact, there were several records for that path, I guess from older versions. My expectation is that a new revision of the file would be added to the database through the update process.

How did I get to the state that I had this problem? Of course I didn’t notice the problem immediate, but my guess is that I screwed up something in the datadirectory by originally restoring it from the wrong backup. I later restored from the correct backup but I am guessing that by running with the older backup, things were already screwed up by the time I had corrected the restore.

I’m glad I figured it out. As a last resort I was planning to single-step through the code using the netbeans debugger. While it would have probably taught me a lot about PHP code and about nextcloud development, I didn’t really want to spend so much time with the problem.

I hope this is useful to someone else.