uttrflow / uttrflow/uttrflow-swift
A file path with more than one space is not recognised as a path, so a default screenshot file name reads as text
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 277
Description
## What happens
`PathShape.matches` (`Sources/UttrflowClipboard/ClipKindDetector.swift:80-104`) allows at most one space:
```swift
// At most one space and no flag: "Application Support" passes, `./deploy.sh --force` does not.
let parts = text.split(separator: " ", omittingEmptySubsequences: false)
guard parts.count <= 2 else { return false }
```
macOS names are full of spaces, so many real paths are classified `.text`.
## Measured (headless, `ClipKindDetector.kind(of:)`)
| Clip | Kind |
|---|---|
| `~/Desktop/Screen Shot 2026-09-14 at 10.12.00.png` | text |
| `~/Library/Mobile Documents/com~apple~CloudDocs/Plan 2026.pages` | text |
| `~/Documents/My Project Files/report final.pdf` | text |
| `/Volumes/Backup Drive/Photos` | filePath |
| `/Applications/Visual Tool.app` | filePath |
| `/tmp/a -b` | text (correct: a flag) |
Copying a path with ⌥⌘C in the file manager is the usual way a path reaches the clipboard, and the default screenshot name alone has four spaces.
## Why it matters
A path row gets a folder icon, monospaced text and a row that names the folder (`ClipKind.filePath`). The paths people copy most often lose all three.
## Acceptance criteria
- Paths whose components contain several spaces are `.filePath`, including the three text rows above.
- Everything in `PathShapeTests`' "things that merely contain a slash" still returns false, and so do `./deploy.sh --force`, `cat /etc/hosts | grep localhost` and a sentence that starts with a slash and has no second slash.
- One possible rule: keep "no part starts with `-`" and the forbidden characters, and drop the space count when the text starts with `/` or `~/` and contains at least two `/`. The contributor may find a better one; the tests decide.
## Where to start
- `Sources/UttrflowClipboard/ClipKindDetector.swift:80-104`
- Test to extend: `Tests/UttrflowClipboardTests/PathShapeTests.swift` (add the rows above to "paths people actually copy")
- Before pushing, run `make verify` (export `DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer` first). It is the same command CI runs, and it enforces the 95% coverage floor per module.
- Read [CONTRIBUTING.md](https://github.com/uttrflow/uttrflow-swift/blob/main/CONTRIBUTING.md) first, and say on this issue that you are taking it.
**Size:** S, about 1 to 2 hours.
Contributor guide
Research direction
Read CONTRIBUTING.md, then inspect PathShape.matches in Sources/UttrflowClipboard/ClipKindDetector.swift:80-104 and the existing cases in Tests/UttrflowClipboardTests/PathShapeTests.swift. Extend the tests with the listed copied paths and run make verify with DEVELOPER_DIR set; done means those paths are filePath while the existing slash-only and command examples remain false.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 90/100