owncloud / owncloud/ocis-workflows

webdavfile: mkcol's 409 handling may treat 'missing parent' as 'already exists'

Open
#42 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
0
Forks
0
Avg merge
3d 23h
Merged PRs (30d)
9

Description

Follow-up from review on #24 (feat(backend): add create-folder action node).

CreateFolder calls the pre-existing mkcol helper unchanged, which treats both 405 and 409 as "already exists, treat as success." Per RFC 4918 §9.3 (WebDAV MKCOL), these mean different things:

  • 405 ("MKCOL can only be executed on an unmapped URL") is genuinely "already exists."
  • 409 ("a collection cannot be made at the Request-URI until one or more intermediate collections have been created") means the opposite — the parent doesn't exist yet, and the folder was not created.

If oCIS follows the spec here, mkcol currently swallows that failure silently and reports success.

This is pre-existing code, not introduced by #24, but two things make it newly relevant now that createFolder is a first-class user-facing action:

  • The codebase's own Comment() method — right above mkcol in the same file — already works around exactly this by calling mkcol(".workflows") then mkcol(".workflows/comments") as two explicit, ordered calls, rather than relying on one call to create a nested path. That pattern only makes sense if the author already knew MKCOL doesn't auto-create intermediate collections.
  • createFolder's own example usage is a nested path (/Archive/{{llm.output}}), and any path more than one level deep where the parent doesn't already exist would plausibly hit this case. The existing TestCreateFolderTreatsAlreadyExistsAsSuccess test bakes the 405-and-409-are-equivalent assumption in against a hand-written fake server — it can't tell us whether that assumption matches real oCIS behavior.

Action item: verify directly against a real oCIS instance whether MKCOL against a path with a missing intermediate parent actually returns 409. If so, either:

  • (a) stop treating 409 as success and surface it as a real error telling the user to create the parent first, or
  • (b) make CreateFolder create each path segment in turn (mirroring Comment's own pattern) so multi-level paths work as users would expect.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating CreateFolder, mkcol, Comment, and TestCreateFolderTreatsAlreadyExistsAsSuccess. Verify MKCOL behavior against a real oCIS instance when an intermediate parent is missing, then determine which behavior the project should adopt. Update the implementation and tests so the result distinguishes an existing collection from a missing parent, and confirm the nested-path example is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.