8000 conditional downloads by ryancdotorg · Pull Request #125 · looterz/grimd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

conditional downloads #125

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 1 commit into
base: master
Choose a base branch
from

Conversation

ryancdotorg
Copy link
Contributor

This patch enhances downloading of hosts files/blocklists by adding support for conditional download based on ETag or Date headers.

Temporary files are also now used when downloading hosts files/blocklists.

return nil, fmt.Errorf("error downloading source: %s %s", uri, err)
}

current, err := os.ReadFile(filePath)

Check failure

Code scanning / gosec

Potential file inclusion via variable Error

Potential file inclusion via variable
// header with an ETag and If-Modified-Since with a Date are set, the
// latter is supposed to be ignored, but not all servers work like that.
if etag := response.Header.Get("ETag"); etag != "" {
output.WriteString(fmt.Sprintf("# ETag: %s\n", etag))

Check warning

Code scanning / gosec

Errors unhandled. Warning

Errors unhandled.
if etag := response.Header.Get("ETag"); etag != "" {
output.WriteString(fmt.Sprintf("# ETag: %s\n", etag))
} else if date := response.Header.Get("Date"); date != "" {
output.WriteString(fmt.Sprintf("# Date: %s\n", date))

Check warning

Code scanning / gosec

Errors unhandled. Warning

Errors unhandled.
output.WriteString(fmt.Sprintf("# Date: %s\n", date))
}

output.WriteString("\n")

Check warning

Code scanning / gosec

Errors unhandled. Warning

Errors unhandled.
logger.Criticalf("Error closing file: %s\n", err)
}

if err := os.Chmod(tempPath, 0o644); err != nil {

Check failure

Code scanning / gosec

Expect file permissions to be 0600 or less Error

Expect file permissions to be 0600 or less
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
0