Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe PR adds support for exposing the Description metadata field through the file naming mask system by introducing EXIF query constants, implementing metadata retrieval logic with a new helper method, updating UI documentation for the new escape code, and adding corresponding unit tests. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant RenameWindow as UI<br/>(RenameWindow)
participant MaskBasedNaming as Naming Logic<br/>(MaskBasedNaming)
participant ExifHandler as EXIF Handler<br/>(ExifHandler)
participant Metadata as EXIF Data
User->>RenameWindow: Enter filename mask with |desc|
RenameWindow->>MaskBasedNaming: GetFileName(filename, mask)
MaskBasedNaming->>MaskBasedNaming: Parse "desc" tag
MaskBasedNaming->>MaskBasedNaming: AppendMetadata(sb, DescriptionQuery1, DescriptionQuery2)
MaskBasedNaming->>ExifHandler: Get metadata using DescriptionQuery1
ExifHandler->>Metadata: Query /app1/{ushort=0}/{ushort=270}
alt Metadata found
Metadata-->>ExifHandler: Return description value
ExifHandler-->>MaskBasedNaming: Return description
else Query1 failed
MaskBasedNaming->>ExifHandler: Get metadata using DescriptionQuery2
ExifHandler->>Metadata: Query /ifd/{ushort=270}
Metadata-->>ExifHandler: Return description value
ExifHandler-->>MaskBasedNaming: Return description
end
MaskBasedNaming->>MaskBasedNaming: Append description to result
MaskBasedNaming-->>RenameWindow: Return processed filename
RenameWindow-->>User: Display renamed file with description field
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@PhotoLocator/Metadata/MaskBasedNaming.cs`:
- Around line 122-127: AppendMetadata currently appends arbitrary free-text from
GetMetadata().GetQuery into result which can introduce characters invalid in
filenames; update AppendMetadata in MaskBasedNaming (and/or a helper used by it)
to sanitize the returned value from GetQuery by replacing or removing
Path.GetInvalidFileNameChars (and optionally Path.GetInvalidPathChars) and
trimming whitespace (e.g., replace each invalid char with '_' or remove), handle
null/empty values safely (skip or append empty) and then append the sanitized
string to result so filenames produced by MaskBasedNaming are valid.
In `@PhotoLocatorTest/Metadata/MaskBasedNamingTest.cs`:
- Around line 89-94: The test expects a filename containing backslashes which
are path separators and invalid in filenames; update AppendMetadata in
MaskBasedNaming (the metadata-handling routine used by _renamer.GetFileName and
referenced by GetFileNameWithMaskDescription) to sanitize metadata values by
removing or replacing Path.GetInvalidFileNameChars (and optionally
Path.GetInvalidPathChars) before inserting into the mask, or alternatively
reject/throw when metadata contains path separators; pick
sanitize-by-replacement (e.g., replace invalid chars with '_' or remove them)
and add a unit test change or new test documenting this sanitized behavior.
🧹 Nitpick comments (1)
PhotoLocator/Metadata/MaskBasedNaming.cs (1)
226-229:desctag doesn't support the:format specifier unlike other tags.Other tags use
TagIs(tag, "desc", out iColon)pattern allowing format options (e.g.,|desc:20|for truncation). The currenttag == "desc"exact match is fine if no formatting is needed, but it's inconsistent with the other tag patterns. This is a minor design consideration for future extensibility.
Summary by CodeRabbit
New Features
Tests