Skip to content

Improve string and file extension handling: ReplaceAll & filepath.Ext #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Gofastasf
Copy link
Contributor

@Gofastasf Gofastasf commented Feb 2, 2025

Replaced strings.Replace with updated strings.ReplaceAll

Use filepath.Ext for file extension instead of strings.HasSuffix.

- Replaced os.Stat call and os.Create with os.OpenFile with O_EXCL to avoid TOCTOU.
- Improved logic to handle file size check only when the file exists.

Signed-off-by: Gofastasf <[email protected]>
@jaypipes
Copy link
Owner

jaypipes commented Feb 3, 2025

@Gofastasf please rebase this to main and update your PR summary :) thank you!

@Gofastasf Gofastasf changed the title Update code Improve string and file extension handling: ReplaceAll & filepath.Ext Feb 4, 2025
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.

2 participants