Skip to content

Conversation

bitgroestl
Copy link
Contributor

@bitgroestl bitgroestl commented Mar 21, 2025

Summary

This fixes #7281.

I simply removed the string DRAFT_MEDIA_FILES from the return value of selectMediaFolder and the issue disappeared.
I have no idea why this string existed in the first place, but i highly advise that someone with more insight takes a look at this PR in case it breaks anything.

Test plan

I updated the corresponding test to reflect how i think this should work.
npm run test doesn't show any failures.

Checklist

Please add a x inside each checkbox:

@janw
Copy link

janw commented May 26, 2025

This is currently blocking me. Would love to see it merged. 🙏🏻

@martinjagodic martinjagodic requested a review from Copilot June 5, 2025 08:17
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes #7281 by removing the unused "DRAFT_MEDIA_FILES" string constant from the media folder resolution logic. The key changes include:

  • Removing the declaration of the "DRAFT_MEDIA_FILES" constant.
  • Updating the logic in selectMediaFolder to no longer append "DRAFT_MEDIA_FILES" when entryPath is undefined.
  • Adjusting corresponding tests to reflect the new behavior in media folder selection.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/decap-cms-core/src/reducers/entries.ts Removed the "DRAFT_MEDIA_FILES" constant and updated fallback media folder logic to use solely the collection folder.
packages/decap-cms-core/src/reducers/tests/entries.spec.js Updated test expectations to match the new behavior of selectMediaFolder.
Comments suppressed due to low confidence (2)

packages/decap-cms-core/src/reducers/entries.ts:528

  • Verify that removing the 'DRAFT_MEDIA_FILES' constant does not disrupt any legacy code paths or assumptions about the media folder structure.
const DRAFT_MEDIA_FILES = 'DRAFT_MEDIA_FILES';

packages/decap-cms-core/src/reducers/entries.ts:748

  • Ensure that the updated fallback logic, which now returns only the collection folder, aligns with the overall design for media folder resolution.
: (collection!.get('folder') as string);

@HFulcher
Copy link

This is a blocker for me as well currently. Would love to see it merged!

@martinjagodic martinjagodic enabled auto-merge (squash) August 18, 2025 09:05
@martinjagodic martinjagodic merged commit cbde141 into decaporg:main Aug 18, 2025
7 checks passed
martinjagodic pushed a commit to poslovnimediji/decap-cms that referenced this pull request Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

collection with path in Gitea returns error 400 for DRAFT_MEDIA_FILES
4 participants