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

Regression: Image card with thumbnails not showing after upload #1220

Closed
buzzlightyear182 opened this issue Apr 1, 2018 · 5 comments · Fixed by #1221
Closed

Regression: Image card with thumbnails not showing after upload #1220

buzzlightyear182 opened this issue Apr 1, 2018 · 5 comments · Fixed by #1221

Comments

@buzzlightyear182
Copy link

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

- What is the current behavior?
When I upload an image, page needs to be reloaded in order for image block to appear. I can see the photo is uploaded when the button changes back to "Upload New". Deleting an image works fine as expected. Attached is a screenshot of the errors in console. Not sure why API.js is unauthorized as I can login and publish articles already.

- If the current behavior is a bug, please provide the steps to reproduce.
Code is hosted on a public repo. I used <script src="https://unpkg.com/netlify-cms@^1.4.0/dist/cms.js"></script> and <link rel="stylesheet" href="https://unpkg.com/netlify-cms@^1.4.0/dist/cms.css" /> in admin/index.html
Upload image in Media

- What is the expected behavior?
When image is uploaded, thumbnail and file name should appear once done.

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

Netlify v1.4.0

- Please link or paste your config.yml below if applicable.
screen shot 2018-04-01 at 3 10 31 pm

config.yml

backend:
  name: git-gateway
  branch: master # Branch to update (master by default)
  
media_folder: "source/blog/images" # Folder where user uploaded files should go
public_folder: "/blog/images" # CMS now knows 'source' is the public folder and will strip this from the path

publish_mode: editorial_workflow

collections: # A list of collections the CMS should be able to edit
  - name: "news" # Used in routes, ie.: /admin/collections/:slug/edit
    label: "Create News Article" # Used in the UI, ie.: "New Post"
    folder: "source/blog/news" # The path to the folder where the documents are stored
    create: true # Allow users to create new documents in this collection
    slug: "{{slug}}"
    fields: # The fields each document in this collection have
      - {label: "Title", name: "title", widget: "string"}
      - {label: "Layout", name: "layout", widget: "hidden", default: "article"}
      - {label: "Category", name: "category", widget: "hidden", default: "news"}
      - {label: "Tags", name: "tags", widget: "string"}
      - {label: "Featured Image", name: "cover_image", widget: "image"}
      - {label: "Date", name: "date", widget: "date"}
      - {label: "Summary", name: "metadescription", widget: "string"}
      - {label: "Body", name: "body", widget: "markdown"}
  - name: "learning-zone" # Used in routes, ie.: /admin/collections/:slug/edit
    label: "Create Learning Zone Article" # Used in the UI, ie.: "New Post"
    folder: "source/blog/learning-zone" # The path to the folder where the documents are stored
    create: true # Allow users to create new documents in this collection
    slug: "{{slug}}"
    fields: # The fields each document in this collection have
      - {label: "Title", name: "title", widget: "string"}
      - {label: "Layout", name: "layout", widget: "hidden", default: "article"}
      - {label: "Category", name: "category", widget: "hidden", default: "learning-zone"}
      - {label: "Tags", name: "tags", widget: "string"}
      - {label: "Featured Image", name: "cover_image", widget: "image"}
      - {label: "Date", name: "date", widget: "datetime"}
      - {label: "Summary", name: "summary", widget: "string"}
      - {label: "Body", name: "body", widget: "markdown"}
@tech4him1
Copy link
Contributor

@buzzlightyear182 Can you try running localStorage.clear() in your browser console, then reloading the page and logging in again?

@buzzlightyear182
Copy link
Author

@tech4him1 I did just that, it's still not working. localStorage.clear() returns Undefined and it automatically logs me out. But when I reload, login and upload a new photo it still returns the same JS errors.

@erquhart
Copy link
Contributor

erquhart commented Apr 2, 2018

This looks similar to the issue @owenhoskins was running into.

@tech4him1
Copy link
Contributor

tech4him1 commented Apr 2, 2018

Quoting (Owen Hoskins @owenhoskins Mar 30 05:06):

Hello all, I am hitting a strange issue where https://github.com/netlify/netlify-cms/blob/cd10a713d806d5d55fac085a8aae14e287fb92b5/src/backends/github/implementation.js#L154 is throwing a 500 (Internal Server Error) Server Error at APIError.ExtendableBuiltin. The issue is somehow specific to my site's repo because it's not reproducible when testing against another repo both locally and running on netlify. The repo's are public so its not a private repo issue. Any any ideas what about this particular repo could be upsetting the git API?

I'm not sure this is related, since his is a 500 error, and this is a 401.

@tech4him1
Copy link
Contributor

tech4him1 commented Apr 2, 2018

I'm able to reproduce. This is a regression in v1.4.0, caused by the private repo-checking code introduced in #994. It does this by getting the repository metadata from GitHub. Git Gateway blocks this request with a 401 ("Access to endpoint not allowed: this part of GitHub's API has been restricted"), because part of the point of Git Gateway is that users are not allowed to get direct repo access.

@erquhart @Benaiah What do you think is the best way to fix this? Do we just re-fetch the images (as discussed in #994) for every Git Gateway repo, since it may or may not be private? Obviously this will be much easier after #990 anyway.

@tech4him1 tech4him1 changed the title Image card with thumbnails not showing after upload Regression: Image card with thumbnails not showing after upload Apr 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants