Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not change content of image when replace image in NextCloud #278

Closed
thanhcong7893 opened this issue Oct 28, 2019 · 27 comments
Closed

Not change content of image when replace image in NextCloud #278

thanhcong7893 opened this issue Oct 28, 2019 · 27 comments
Labels
1. to develop Accepted and waiting to be taken care of bug Something isn't working

Comments

@thanhcong7893
Copy link

Describe the bug
When I replace once image in NextCloud, I view image by viewer, it do not change image in spite of I change content of changed image.

@thanhcong7893 thanhcong7893 added 0. Needs triage Pending approval or rejection. This issue is pending approval. bug Something isn't working labels Oct 28, 2019
@skjnldsv
Copy link
Member

Hey!
Thanks fro reporting!
So you changed the original file, and opening it in the viewer still show the old one?

A few questions then:

  • did you reload the page?
  • did you clear your browser's cache? If not, after you do it, does it show the new image again?

I have a few possibilities here:

  1. the generated preview is not updated
  2. the browser's cache does not force refresh

cc @rullzer

@skjnldsv skjnldsv added the needs info Not enough information provided label Oct 28, 2019
@rullzer
Copy link
Member

rullzer commented Oct 28, 2019

Does the viewer force reload images? As we set the last modified header

@skjnldsv
Copy link
Member

@rullzer we rely on a simple <img src=, so no idea how the cache is handled in that case :)

@rullzer
Copy link
Member

rullzer commented Oct 28, 2019

Let me try to reproduce then

@skjnldsv
Copy link
Member

@rullzer you can also wait for @thanhcong7893's input ;)

@rullzer
Copy link
Member

rullzer commented Oct 28, 2019

I can reproduce this.

I guess it is because of thecache headers. Will test.

@rullzer
Copy link
Member

rullzer commented Oct 28, 2019

So yes and no. Part is that. But once the image is downloaded by the browser it doesn't revalidate in the same request. We could add a cache buster. But that would mean we keep downloading.

I guess for now you'll just have to reload

@thanhcong7893
Copy link
Author

@skjnldsv
I show you each step I did.
Step1: I upload a image file
Capture

Step 2: I view this image.
Capture1

Step 3: I upload a new file to replace old file.
Capture2

Capture3

Step 4: I view once again. See content of old image
Capture4

I reloaded page, but not working. However I download file which is still new file.

@skjnldsv
Copy link
Member

skjnldsv commented Oct 29, 2019

Thanks :)
If you right click and open the image (from the viewer) in a new tab.
Does it show the new one? While still being on this new tab, if you do a force refresh (Ctrl + Shift/(CMD if mac) + R)

@thanhcong7893
Copy link
Author

I pressed Ctrl + Shift/(CMD if mac) + R to force refresh and I opened new tab to view . But It do not change. However I open my incognito and view again that worked.

@skjnldsv
Copy link
Member

@rullzer so, browser cache :)

@skjnldsv skjnldsv removed the needs info Not enough information provided label Oct 29, 2019
@thanhcong7893
Copy link
Author

thanhcong7893 commented Oct 29, 2019

How to fix it or auto force update cache browser

@rullzer
Copy link
Member

rullzer commented Oct 29, 2019

Well we can limit the cached time of course. I'll see what I can do but this is rather low priority on my list.

@rullzer rullzer self-assigned this Oct 29, 2019
@skjnldsv
Copy link
Member

@rullzer I would add a parameter to the preview url with the mtime, so if it changes, then it will force the reload?

@thanhcong7893
Copy link
Author

@skjnldsv How long do you fix it?

@skjnldsv
Copy link
Member

@thanhcong7893 well, we're all working in lots of locations for this, so I cannot give you ETA :)

@skjnldsv skjnldsv added 1. to develop Accepted and waiting to be taken care of and removed 0. Needs triage Pending approval or rejection. This issue is pending approval. labels Oct 30, 2019
@rullzer
Copy link
Member

rullzer commented Oct 30, 2019

@skjnldsv sounds fair enough

@rullzer
Copy link
Member

rullzer commented Oct 30, 2019

@skjnldsv better yet you also have the etag right?

@Ark74
Copy link

Ark74 commented Jan 9, 2020

I have an svg image with a bit of text that if you change just two characters then render a png, the md5sum of the redendered png will be the same as the previous rendered one (with unchanged characters).
This is the first time I see something like this.

The browsers keeps using the first one, if the name is changed, the same.

What to do on a case like this?

Update: Seems like going to the WebUI delete the file, go to the trashbin and delete it there, is the only way it will update to the latest and new rendered image.

Regards

@freddyli
Copy link

Actually I have JPG files which are located on external storage (local). When they change (e.g. edited via GIMP), the previews are not updated. Thus all the views using e.g. the web UI show the old image. If I download it, it is actually the new/changed version.

The only way to get Nextcloud to show the new version in the web UI is to delete the previews directory and rescan / regenerate... =(

@skjnldsv
Copy link
Member

@freddyli when you change the file, do you edit it directly on your nxtcloud files, or are they synced with a client? (android, desktop...)
The preview should update itself everytime Nextcloud detect a change. (on the files app at least)

If it only occurs on the photos app, then please tell me :)

@freddyli
Copy link

@skjnldsv Thanks for the quick reply!

In this case I have "external storage" mounted in nextcloud, which is indeed a local folder on the machine. Nextcloud is supposed to check for file / directory changes on each access / listing of the directory - Setting:

Check for changes: Once every direct access

So if I change the image "from outside", then look at the modified date, it stays the same.(**) If I then e.g. create a folder in the same folder, the modified date of my image gets also updated in the web UI.

But: Looking at the image (the following link is used: .../core/preview?fileId=12620&x=2048&y=1152&a=true), the content looks like the old image. Even after clearing / bypassing the browser cache.

So, the previews seem to not being updated or the image seems to not being recognized as changed.

I hope this clears things up a bit; in spite of those many words =)


(**) maybe this can also be optimized in the External storage support app ...

@skjnldsv
Copy link
Member

Yep, the issue seems more like an external storage problem :)
Could you search the server repo, there might eb an existing issue already.
If not, we'll transfer this one 😉

@freddyli
Copy link

Hi @skjnldsv - thanks for "confirming" - honestly I do not know how to search the nextcloud/server repo issues efficiently. If i search there for preview external I get more than 800 results. Scrolling through the first couple of pages do not reveal an appropriate / similar issue to me. So I guess it would make sense to transfer the issue there. Or maybe there is a "query/search language" in github and some "github guru" can search for a similar issue there.. =)

@skjnldsv
Copy link
Member

Or maybe there is a "query/search language" in github and some "github guru" can search for a similar issue there

I'll be honest, I've been around for a while, and I still fail to find some issues with github search 😅

@skjnldsv
Copy link
Member

I tested it lately with the addition of the image editor and it works fine

@dsm1212
Copy link

dsm1212 commented Sep 26, 2023

@skjnldsv I'm having this problem in 2023 with latest docker image. I don't understand your final comment here about the image editor and I wanted to understand what that means. My use case is like freddyli's I believe, this doesn't involve any editting in next cloud. I export files from lightroom to an external storage folder in nextcloud, then later after my family have selected pictures I do more involved edits and then export them from lightroom again. Nothing I can do in nextcloud seems to get the viewer to show the updated files even though downloading gets the new file of course. Incognito or even a second computer does not help so I don't think this is browser cache. I run preview:generate-all and it lists all the files as being updated but still I see the wrong image. if I turn off previews for the folder then when I view the file it is correct but this prevents using thumbnails and slows down the viewing. Very frustrating. I don't want to frequently delete my previews folder as I have thousands of images. Any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants