Skip to content

Conversation

@djdv
Copy link
Contributor

@djdv djdv commented Oct 7, 2025

This is for: ipfs/kubo#9370
Specifically this comment for context: ipfs/kubo#9370 (comment)

e579012 is the main fix
In short, this plain-string used to be a regex-string where [ and ] have meaning, they're not part of the set so they should not be used with ContainsAny.

4b9e075
Is a secondary fix that catches reserved names even if their case differs.
I don't know if anyone has encountered this in IPFS yet, but I know file names like con show up in various operating system source trees.

The rest of the patches are gardening and testing.
The sanitize tests hit 100% coverage with this, and I tested this explicitly in go-ipfs via ipfs get.
Prior to the patch, we hit the bug. After, we don't.

> ipfs add -r -w 'T:\Temp\[works on my machine]\'
added QmPFaJjSbNVJxG1PTQYVJAkycHTbsZzBLtJRFCo9BvAgbm [works on my machine]/[works for me].png
added QmeKh8Lq1JKk4LLVc2xuJ5VsCBUgUJ3YXa4Umnkb6Urrih [works on my machine]
added QmaSWjLPmJoPBPtUQ9geGCCvNms5EaNkMS2DzgW5NHbP45

> ipfs-stable get QmaSWjLPmJoPBPtUQ9geGCCvNms5EaNkMS2DzgW5NHbP45
Saving file(s) to QmaSWjLPmJoPBPtUQ9geGCCvNms5EaNkMS2DzgW5NHbP45
Error: invalid platform path: path components cannot contain any of [<>:"\|?*] : "[works on my machine]"

> ipfs-dev get QmaSWjLPmJoPBPtUQ9geGCCvNms5EaNkMS2DzgW5NHbP45
Saving file(s) to QmaSWjLPmJoPBPtUQ9geGCCvNms5EaNkMS2DzgW5NHbP45
 440.79 KiB / 440.79 KiB [=] 100.00% 0s

Probably good?

@djdv djdv requested a review from a team as a code owner October 7, 2025 18:49
@welcome
Copy link

welcome bot commented Oct 7, 2025

Thank you for submitting this PR!
A maintainer will be here shortly to review it.
We are super grateful, but we are also overloaded! Help us by making sure that:

  • The context for this PR is clear, with relevant discussion, decisions
    and stakeholders linked/mentioned.

  • Your contribution itself is clear (code comments, self-review for the
    rest) and in its best form. Follow the code contribution
    guidelines

    if they apply.

Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
Next steps:

  • A maintainer will triage and assign priority to this PR, commenting on
    any missing things and potentially assigning a reviewer for high
    priority items.

  • The PR gets reviews, discussed and approvals as needed.

  • The PR is merged by maintainers when it has been approved and comments addressed.

We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution.
We are very grateful for your contribution!

@codecov
Copy link

codecov bot commented Oct 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.80%. Comparing base (0f1ebac) to head (9274bf1).

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1047      +/-   ##
==========================================
+ Coverage   60.75%   60.80%   +0.04%     
==========================================
  Files         268      268              
  Lines       33593    33590       -3     
==========================================
+ Hits        20411    20425      +14     
+ Misses      11510    11494      -16     
+ Partials     1672     1671       -1     
Files with missing lines Coverage Δ
tar/sanitize_windows.go 100.00% <100.00%> (+39.58%) ⬆️

... and 9 files with indirect coverage changes

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

@djdv djdv force-pushed the fix/win-name-filter branch 3 times, most recently from 077af9d to bf82623 Compare October 10, 2025 16:20
djdv added 8 commits October 10, 2025 12:33
`reservedCharsStr` used to be (fc7299c) a regex pattern where `[` and
`]` are not part of the set, they are the containers of the set.
This accidentally forbids legal filenames that contain `[` and/or `]`.
The check should be case-insensitive.
E.g. `CON`, `con`, CoN`, etc. are all reserved.
Same behavior, just deduplicating and restructuring.
Same behavior restructured.
We check for a `.` suffix above, so the `..` branch will never run.
- Don't postfix symbols with their type name in Go (C-ism).
- Comments should terminate with periods.
- Use arrays over slices for fixed-size ranges.
- No overly long lines.
- Constant declarations typically precede variable declarations
@djdv djdv force-pushed the fix/win-name-filter branch from bf82623 to 9274bf1 Compare October 10, 2025 16:33
Copy link
Contributor Author

@djdv djdv left a comment

Choose a reason for hiding this comment

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

I should have drafted this first, too late now.
Gave this a second look and made some minor changes.
I'm content with this, so it should be ready for external review.
Edit: might be best to review commit-by-commit rather than starting with the full-diff. idk

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.

1 participant