decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.96k stars 3.05k forks source link

collection with path in Gitea returns error 400 for DRAFT_MEDIA_FILES #7281

Open bbaulenas opened 2 months ago

bbaulenas commented 2 months ago

Hi! I'm facing an error, it's my first time using Decap.

Describe the bug I've created a collection with a specific path, when i try to create a new object in the admin it keeps loading with an error in console: GET https://mygitea.com/api/v1/repos/myname/myrepo/git/trees/blog:blog%2Fcontent%2Fblog%2FDRAFT_MEDIA_FILES 400 (Bad Request)

If I remove the collection "path" and media folders, all works as expected.

To Reproduce Create a collection with this config in a Gitea backend

backend:
  name: gitea
  repo: my-user/my-repo
  app_id: my-app-id
  api_root: https://mygitea.com/api/v1
  base_url: https://mygitea.com
  auth_endpoint: https://mygitea.com/login/oauth/authorize
  branch: blog

site_url: http://localhost
display_url: https://your-site.com

media_folder: "blog/static/uploads"
public_folder: "static/uploads" # la ruta d'imatges que posa decap

collections:
  - name: "blog"
    label: "Blog"
    folder: "blog/content/blog"
    path: '{{year}}/{{month}}/{{slug}}/content'
    media_folder: ''
    public_folder: ''
    create: true
    slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
    fields: 
      - { label: "Layout", name: "layout", widget: "hidden", default: "blog" }
      - { label: "Title", name: "title", widget: "string" }
      - { label: "Publish Date", name: "date", widget: "datetime" }
      - { label: "Featured Image", name: "thumbnail", widget: "image" }
      - { label: "Rating (scale of 1-5)", name: "rating", widget: "number" }
      - { label: "Body", name: "body", widget: "markdown" }

Expected behavior Allow me to create a collection object and store images in "{{year}}/{{month}}/{{slug}}/content"

Applicable Versions: