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

Media library images become 404 after a while #787

Closed
erquhart opened this issue Nov 9, 2017 · 9 comments · Fixed by #2817
Closed

Media library images become 404 after a while #787

erquhart opened this issue Nov 9, 2017 · 9 comments · Fixed by #2817

Comments

@erquhart
Copy link
Contributor

erquhart commented Nov 9, 2017

- Do you want to request a feature or report a bug?

bug

- What is the current behavior?

If left open a while, all of the images in the media library show as broken images. This may only affect private repos, and seems linked to token expiration.

- If the current behavior is a bug, please provide the steps to reproduce.

  • Open the media library with content in a private GitHub repo
  • Leave page open in the background for a few minutes

- What is the expected behavior?

Images should not show as broken (404)

- Please mention your CMS, node.js, and operating system version.

CMS 0.7.0

@erquhart
Copy link
Contributor Author

erquhart commented Nov 9, 2017

Regardless of the token issue, the media library shouldn't be reloading images at any point in a session, we need to ensure the call for media in the GitHub backend only occurs once and that the original set is returned in subsequent calls.

@some1else
Copy link

Still experiencing this with private repos in 1.0.3. Is a fix still in the works? Willing to help out

@erquhart
Copy link
Contributor Author

The fix for this is going to be #946 - that will introduce thumbnail creation on image upload, and the thumbnail will be committed as metadata, at which point we can begin pulling thumbnails through the API instead of by URL.

@owenhoskins started work on that effort but got busy, maybe you can reach out and see about helping move it forward?

@Kinark
Copy link

Kinark commented Aug 24, 2019

Any updates on this? Having the same issue :(

@marcojakob
Copy link

I see this issue also after I've just logged in. Then only the newly uploaded images are visible.

We have a lot of users of NetlifyCMS and I recommend all of them to use private GitHub repos since it's not very wise to show all the changes to the public including blog posts that are not published yet.

I guess it is because of token expiration. I could imagine that - as @erquhart describes - the token expires if the CMS is left open for a few minutes and then doesn't recover from this state even after a new login.

Workaround: It seems I can get the images back with a full browser refresh.

@erezrokah
Copy link
Contributor

It looks like GitHub raw content URLs are returned with Cache-Control: max-age=300 which means they will stay in the browser cache for at most 300 seconds (then probably the browser tries to load them with an expired token).

image

We should be able to re-use the code from the GraphQL API fix here to handle this.

The GraphQL fix is in the master branch if you're willing to give it a go by adding use_graphql: true to your backend config.

@erezrokah
Copy link
Contributor

This issue can be reproduced faster when disabling cache in developer tools:
image

@roganflitton
Copy link

@erquhart we are currently experiencing this issue with a netlify.com cms linked to a private github repo. I see this issue has been closed. Was it fixed or has it been closed because its been merged with #946 ?

@erquhart
Copy link
Contributor Author

@roganflitton this was fixed in #2817 - can you confirm that you're running 2.10.0 or greater?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants