fix(gmail): combine --name with directory --out in attachment download#248
Closed
zerone0x wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(gmail): combine --name with directory --out in attachment download#248zerone0x wants to merge 1 commit intoopenclaw:mainfrom
zerone0x wants to merge 1 commit intoopenclaw:mainfrom
Conversation
When --out points to a directory, the --name flag was silently ignored and the directory path itself was used as the output file path. This led to confusing behavior where the cache check accepted the directory as a valid cached attachment (since os.Stat succeeds on directories). Now when --out is a directory, it is combined with --name (or the default filename) via filepath.Join. The cache validation also requires IsRegular() so directories can never produce false cache hits. Fixes openclaw#222 Co-Authored-By: Claude <noreply@anthropic.com>
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #222
When
--outpoints to a directory (e.g.--out /tmp/), the--nameflag was silently ignored and the directory path itself was used as the output file path. This caused two problems:--nameignored:--out /tmp/ --name invoice.pdfwould write to/tmp/instead of/tmp/invoice.pdfos.Statsucceeds on directories andSize() > 0is always true for themChanges
--outresolves to an existing directory, combine it with--name(or the default filename) viafilepath.Joinst.Mode().IsRegular()to cache validation indownloadAttachmentToPathso directories never produce false cache hits--namehelp text to reflect that it works with directory--outvaluesTest Plan
go test ./...passes (all packages green)expectedSize == -1is not treated as cache hitexpectedSize > 0is not treated as cache hitmake lintpasses (0 issues)make buildsucceeds🤖 Generated with Claude Code (issue-hunter-pro)