[3.1.6] Avatars are not displaying since update - but a valid file is being sent.

Get help with installation and running phpBB 3.1.x here. Please do not post bug reports, feature requests, or extension related questions here.
Anti-Spam Guide
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: phpBB 3.1.x is at its End of Life stage and support will NOT be provided after July 1st, 2018.
Locked
digitaltoast
Registered User
Posts: 105
Joined: Thu Oct 18, 2007 9:33 am

[3.1.6] Avatars are not displaying since update - but a valid file is being sent.

Post by digitaltoast »

Support Request Template
What version of phpBB are you using? phpBB 3.1.6
What is your board's URL? https://www.reading-forum.co.uk/forum/
Who do you host your board with? DigitalOcean
How did you install your board? I used the download package from phpBB.com
What is the most recent action performed on your board? Update from a previous version of phpBB3
Is registration required to reproduce this issue? No
Do you have any MODs installed? No
Do you have any extensions installed? Yes
What version of phpBB3 did you update from? phpBB 3.1.5
What extensions do you have installed?
Enabled Extensions
Auto Database Backup 1.1.0
Disabled Extensions (disabled just to exclude them from being the issue)
Advanced BBCode Box 3.1.1
Background Forum 1.0.4
Background header 1.0.1
Board Announcements 1.0.4
Board Rules 1.0.2
Collapsible Forum Categories 1.0.0
Google Analytics 1.0.1
Pages 1.0.3
What styles do you currently have installed? Prosilver
What language(s) is your board currently using? British English
Which database type/version are you using? MariaDB
What is your level of experience? Comfortable with PHP and phpBB
What actions did you take (updating your board; installing a MOD, style or extension; etc.) prior to this problem becoming noticeable? Did a "clean" update to 3.1.6 using the following method (as I had no extensions before updating to 3.1.6)

Code: Select all

Delete the following files/directories from your board EXCEPT for:
The config.php file
The images/ directory
The files/ directory
The store/ directory
the assets/ directory
Go to yoursite.com/forumfolder/install/database_update.php
Let that run and then delete the install folder.
You now have a new up to date board containing all your users and posts but without any MODs that you might have had installed.
Please describe your problem. Images, thumbnails and downloads in the following format work fine:

https://www.reading-forum.co.uk/forum/d ... &mode=view 0

However, all avatars are now broken. For example:
https://www.reading-forum.co.uk/forum/d ... 540046.jpg

Eventually times out after a minute. Nothing in the error console.
nginx server log looks like this:

988:x.x.x.x - - [19/Oct/2015:15:36:18 +0100] "GET /forum/download/file.php?avatar=4625_14135400461.jpg HTTP/1.1" 200 6420 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.16 Safari/537.36"

The really weird thing is that if you right-click and save-as the square that appears in Google Chrome, then you will see that it is a valid jpg, in this case titled 4625.jpg

Server response looks like this:

Code: Select all

HTTP request status: 200 (OK)
Name	Value
date	Mon, 19 Oct 2015 14:26:45 GMT
cf-cache-status	HIT
last-modified	Fri, 17 Oct 2014 10:00:46 GMT
server	cloudflare-nginx
vary	Accept-Encoding
content-type	image/jpeg
status	200 OK
expires	Sat, 15 Oct 2016 13:36:56 GMT
cache-control	public, max-age=31273811
content-disposition	inline; filename=4625.jpg
cf-ray	237d28eb5f022993-DUB
content-length	6419
version	HTTP/1.1
Generated by SRT Generator

And yet, no such file as 4625_1413540046.jpg seems to exist anywhere on the server, even though it is listed in the database as being the user avatar, and seems to generate a valid file. Been failing to resolve this for 2 days now.
Last edited by digitaltoast on Mon Oct 19, 2015 3:16 pm, edited 1 time in total.
User avatar
Lumpy Burgertushie
Registered User
Posts: 69223
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: [3.1.6] Avatars are not displaying since update - but a valid file is being sent.

Post by Lumpy Burgertushie »

have you at any time, downloaded and/or uploaded the attachments/avatars using filezilla?


robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: [3.1.6] Avatars are not displaying since update - but a valid file is being sent.

Post by david63 »

digitaltoast wrote:Delete the following files/directories from your board EXCEPT for:
The config.php file
The images/ directory
The files/ directory
The store/ directory
the assets/ directory
Where does it say not to delete the assets folder?
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
digitaltoast
Registered User
Posts: 105
Joined: Thu Oct 18, 2007 9:33 am

Re: [3.1.6] Avatars are not displaying since update - but a valid file is being sent.

Post by digitaltoast »

david63 wrote:Where does it say not to delete the assets folder?
My apologies - that was copied from some duff info - in fact I DID delete the assets folder. Sorry.
Lumpy Burgertushie wrote:have you at any time, downloaded and/or uploaded the attachments/avatars using filezilla?
No, but... you got me thinking. That "valid" jpg that downloaded displayed just fine in irfanview, but not in web browsers, and I ran it by something called "jpeginfo" which reported the following:

Code: Select all

4625.jpg  Not a JPEG file: starts with 0x0a 0xff  [ERROR]
So while the jpg info is in there, and the server is sending it as the right MIME type, something seems to have corrupted the avatars. So I tried loading a new one onto my profile, with the same result.

EDIT: SOME PROGRESS!

OK, I ran jpeginfo on all the image files in the images directory of phpbb - they are all valid.

But any avatar downloaded via ?avatar seems to get a couple of bytes added. Have a look at this:

Code: Select all

wget https://www.reading-forum.co.uk/forum/download/file.php?avatar=4625_1413540046.jpg -O avatest.jpg
Saving to: ‘avatest.jpg’
jpeginfo avatest.jpg
avatest.jpg  Not a JPEG file: starts with 0x0a 0xff  [ERROR]
tail -c +2 avatest.jpg > avatest_fixed.jpg
jpeginfo avatest_fixed.jpg
avatest_fixed.jpg   80 x 80   24bit JFIF  N    6418
?????
User avatar
Lumpy Burgertushie
Registered User
Posts: 69223
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: [3.1.6] Avatars are not displaying since update - but a valid file is being sent.

Post by Lumpy Burgertushie »

what are you using to transfer the files back and forth?

If you are using something that transfers files in ascii mode, that could be what is causing this.


robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
digitaltoast
Registered User
Posts: 105
Joined: Thu Oct 18, 2007 9:33 am

Re: [3.1.6] Avatars are not displaying since update - but a valid file is being sent.

Post by digitaltoast »

See previous message. No files are being transferred any where by any sort of ftp.
digitaltoast
Registered User
Posts: 105
Joined: Thu Oct 18, 2007 9:33 am

Re: [3.1.6] Avatars are not displaying since update - but a valid file is being sent.

Post by digitaltoast »

Continuing with more details over at...

http://stackoverflow.com/questions/3322 ... mage-files
User avatar
Oyabun1
Former Team Member
Posts: 23162
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill

Re: [3.1.6] Avatars are not displaying since update - but a valid file is being sent.

Post by Oyabun1 »

Did this problem exist before you added any extensions?

If you look at the page source on your board, line 1 is a blank line, which should not be there. That suggests an error in a file somewhere.
                      Support Request Template
3.0.x: Knowledge Base Styles Support MOD Requests
3.1.x: Knowledge BaseStyles SupportExtension Requests
digitaltoast
Registered User
Posts: 105
Joined: Thu Oct 18, 2007 9:33 am

Re: [3.1.6] Avatars are not displaying since update - but a valid file is being sent.

Post by digitaltoast »

Unsure, as I only noticed the avatar problem after adding the extensions, which was about 10 minutes after updating to 3.1.6.

Since then however, I have disabled all the extensions, and even removed their files. The issue still remains.

You are correct, their does seem to be a blank line. This doesn't happen when files are served directly from nginx.

I have run php in "lint" mode and all files seem valid.

I found something else:

If I use the chrome header viewer inspector, the http response headers for avatars show the following:
content-disposition inline; filename=4625.jpg

But if I use redbot, it shows:
Content-Disposition: inline; filename*=UTF-8''4625.jpg

and warns that

The Content-Disposition header doesn't have a 'filename' parameter.

However, on the official phpbb board, the content-disposition headers seem correct, although as you can see below, this doesn't seem to affect other methods of viewing the image.

Summary:

When downloading or viewing an avatar in the format:
/forum/download/file.php?avatar=4625_1413540046.jpg

a single byte is added to the file, making it invalid.

When viewing an image like this:
/forum/download/file.php?id=2871

the image is totally valid and displays OK.

To re-confirm, all image files currently on the server are valid.
I have tried running the board as "localhost" in non-https to completely remove external factors.
This board was upgraded by deleting all core files and copying the new ones over.
digitaltoast
Registered User
Posts: 105
Joined: Thu Oct 18, 2007 9:33 am

Re: [3.1.6] Avatars are not displaying since update - but a valid file is being sent.

Post by digitaltoast »

SOLVED IT!

Check permissions
https://www.phpbb.com/support/docs/en/3 ... rmissions/

Code: Select all

chown -R forum:forum forum/

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;

cd forum
chmod 777 cache store files images/avatars/upload/
The first bit about chown -R forum:forum forum/ is something I always do after updating anyway, but the chmod is something I THOUGHT I did ages ago. I didn't touch any of those directories when I update the board.
Does 3.1.6 handle temp and cache files differently? All I can think is that phpbb (or something) is trying to cache the response from getting the avatar (?!) and when it found it couldn't, it still send the file but with... with an extra byte?!

But that doesn't even make sense. At all. I can't figure this out at all, but all I can say is that re-doing all the permissions has fixed it.
Locked

Return to “[3.1.x] Support Forum”