Broken images after upgrading to 3.6.2

Just upgraded to 3.6.2 using docker images. After the upgrade, the old images in the channels are gone, leaving broken image icons. The console shows the following error:

detailed_error: "There doesn't appear to be an api call for the url='/api/v3/teams/1rk493uf7przzxqw5khmiz9y5y/files/get/kzn7eh7xjiyo7cdbrettjf489e/texpnrfryfbz8pat54ohmtjcea/5pw79fy8mtfq5x189qye8spu3r/web-na-peterson.JPG'.  Typo? are you missing a team_id or user_id as part of the url?"
id: "api.context.404.app_error"
message: "Sorry, we could not find the page."
status_code: 404

However, when I logged onto the server and check the file, it is there and readable:

root@012a5cf0dbf8:/# file /mattermost/data/teams/1rk493uf7przzxqw5khmiz9y5y/channels/kzn7eh7xjiyo7cdbrettjf489e/users/texpnrfryfbz8pat54ohmtjcea/5pw79fy8mtfq5x189qye8spu3r/web-na-peterson.JPG
/mattermost/data/teams/1rk493uf7przzxqw5khmiz9y5y/channels/kzn7eh7xjiyo7cdbrettjf489e/users/texpnrfryfbz8pat54ohmtjcea/5pw79fy8mtfq5x189qye8spu3r/web-na-peterson.JPG: JPEG image data, JFIF standard 1.02

root@012a5cf0dbf8:/# ls -l /mattermost/data/teams/1rk493uf7przzxqw5khmiz9y5y/channels/kzn7eh7xjiyo7cdbrettjf489e/users/texpnrfryfbz8pat54ohmtjcea/5pw79fy8mtfq5x189qye8spu3r/web-na-peterson.JPG
-rw-r--r--. 1 root root 6173 Nov 21 10:03 /mattermost/data/teams/1rk493uf7przzxqw5khmiz9y5y/channels/kzn7eh7xjiyo7cdbrettjf489e/users/texpnrfryfbz8pat54ohmtjcea/5pw79fy8mtfq5x189qye8spu3r/web-na-peterson.JPG

I can post new images and they are displayed without any error. In the console, it seems it is issuing different api calls for the new image:



Any advice? Thanks.

Hi @compass,

Can you get any affected users to clear their cache and refresh their browser? If they’re receiving the new code, they should be using the newer file APIs (/api/v3/files/SOME_ID/get) since the old ones no longer exist.

I’m having the same problem. I used to do a little hack where I would attach a jpg picture to a post and then inspect and copy the source code of the uploaded image and then delete the attachment and insert the jpg url into the body of my post. Now looking back, all of my posts done using this method have broken images, and that little hack no longer works because the attached file just displays in the sourcecode as a thumbnail preview.

Is there a better way to upload and insert a photograph into a post? (rather than attaching it below?)

And is there any way to recover the lost images in past posts?

Thanks @hmhealey. I don’t think it is a cache issue. I tried on a browser that has never visited the site. I still see the same issue.

@compass That’s strange. All code referencing the route in that error was removed in 3.5. What is the build hash listed in the bottom left of the About Mattermost modal that can be accessed from the main menu in the top-left corner?

Also, I double checked and both routes you listed at the bottom are actually correct.

@meril Unfortunately, I don’t know how you could get those files back without doing it manually. Prior to 3.5, the only reference that we stored to uploaded files were as attachments, so Mattermost won’t have any explicit references to them any more. One of the reasons for those changes were actually to track them independently so that we could potentially support that case in the future.

For inserting images into the post going forward, we have a community member working on some improvements to the thumbnails like displaying a larger preview when only a single file is uploaded (link to Github pull request), which may get in for 3.7 if it’s completed in time.

Thanks @hmhealey. I’m using version 3.6.0 (3.6.2) Team version with postgres.

It seem the URL for the file changed to: /api/v3/teams/1rk493uf7przzxqw5khmiz9y5y/files/get/kzn7eh7xjiyo7cdbrettjf489e/texpnrfryfbz8pat54ohmtjcea/7so4ofq9i7rupko8pfrytkecir/nix.png

But I still got api.context.404.app_error. Is this the new API format?

No, that’s the old API route that was removed in 3.5. The new one should be /api/v3/files/FILEID/get where FILEID was generated by the server when upgrading posts from from 3.4’s format to 3.5’s. Do you have any integrations or users posting using the old route?