Skip to content

Conversation

@skjnldsv
Copy link
Contributor

@skjnldsv skjnldsv commented Dec 9, 2025

Not sure why it fails on 4.0.0 now, discovered on nextcloud/server#56743 while working on the https://github.com/nextcloud/server/blob/d87114287b4bd3c90209dab70f7f0dc0bbb47426/apps/files/src/actions/openFolderAction.ts

Here are the failures without this fix:

FAIL  __tests__/files/node.spec.ts > Encoded source is handled properly > File with special characters
AssertionError: expected '/Photos~⛰️ shot of a $[big} mountain/…' to be '/Photos~⛰️ shot of a $[big} mountain/…' // Object.is equality

Expected: "/Photos~⛰️ shot of a $[big} mountain/really #1's.md"
Received: "/Photos~⛰️ shot of a $[big} mountain/really "

 ❯ __tests__/files/node.spec.ts:753:21
    751| 
    752|   expect(file.encodedSource).toBe('https://cloud.domain.com/remote.php/dav/files/em%20ma!/Photos~%E2%9B%B0%EF%B8%8F%20shot%20of%20a%…
    753|   expect(file.path).toBe('/Photos~⛰️ shot of a $[big} mountain/really #1\'s.md')
       |                     ^
    754|   expect(file.basename).toBe('really #1\'s.md')
    755|  })

FAIL  __tests__/files/node.spec.ts > Encoded source is handled properly > Folder with question mark
AssertionError: expected '/' to be '/Photos?' // Object.is equality

Expected: "/Photos?"
Received: "/"

 ❯ __tests__/files/node.spec.ts:765:23
    763| 
    764|   expect(folder.encodedSource).toBe('https://cloud.domain.com/remote.php/dav/files/emma%3F/Photos%3F')
    765|   expect(folder.path).toBe('/Photos?')
       |                       ^
    766|   expect(folder.basename).toBe('Photos?')
    767|  })

FAIL  __tests__/files/node.spec.ts > Encoded source is handled properly > Folder with percent characters
URIError: URI malformed
 ❯ Folder.get path [as path] lib/node/node.ts:274:16
    272|  get path(): string {
    273|   const url = new URL(this.source)
    274|   let source = decodeURI(url.pathname)
       |                ^
    275| 
    276|   if (this.isDavResource) {
 ❯ __tests__/files/node.spec.ts:777:17

@skjnldsv skjnldsv self-assigned this Dec 9, 2025
@skjnldsv skjnldsv requested review from artonge, nfebe and susnux December 9, 2025 10:43
@skjnldsv skjnldsv added type: bug 🐛 Something isn't working 3. to review 3️⃣ Waiting for reviews labels Dec 9, 2025
@skjnldsv skjnldsv added this to the v4.0.0 milestone Dec 9, 2025
@codecov
Copy link

codecov bot commented Dec 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.74%. Comparing base (cd0ed22) to head (5135de7).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1398      +/-   ##
==========================================
+ Coverage   90.64%   90.74%   +0.09%     
==========================================
  Files          23       23              
  Lines         652      659       +7     
  Branches      175      175              
==========================================
+ Hits          591      598       +7     
  Misses         50       50              
  Partials       11       11              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@skjnldsv skjnldsv merged commit ffa53c1 into main Dec 9, 2025
11 checks passed
@skjnldsv skjnldsv deleted the fix/special-char-encode branch December 9, 2025 11:31
@skjnldsv skjnldsv mentioned this pull request Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review 3️⃣ Waiting for reviews type: bug 🐛 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants