[GH-ISSUE #129] Value of WGET_USER_AGENT not quoted correctly #3106

Closed
opened 2026-03-14 21:03:36 +03:00 by kerem · 2 comments
Owner

Originally created by @sbrl on GitHub (Jan 12, 2019).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/129

Describe the bug
A clear and concise description of what the bug is.

I've noticed that the value of the WGET_USER_AGENT environment variable is not properly quoted by ArchiveBox. For example, I'm setting it to this in bash:

export WGET_USER_AGENT="ArchiveBox/$(git rev-parse HEAD | head -c7) (+https://github.com/pirate/ArchiveBox/) wget/$(wget --version | head -n1 | cut -d" " -f3)";
# Then call ArchiveBox as normal
./archivebox ....

This should result in something like ArchiveBox/7890abc (+https://github.com/pirate/ArchiveBox/) wget/1.18. The above causes a bogus 404 Not Found error on every request. However, changing it to this:

export WGET_USER_AGENT="\"ArchiveBox/$(git rev-parse HEAD | head -c7) (+https://github.com/pirate/ArchiveBox/) wget/$(wget --version | head -n1 | cut -d" " -f3)\"";
# Then call ArchiveBox as normal
./archivebox

....solves the issue.

Expected behavior
A clear and concise description of what you expected to happen.

I shouldn't have to add the quotes manually myself in the WGET_USER_AGENT environment variable

Screenshots
If applicable, add screenshots to help explain your problem.

Here it is not working:

elessar_108

Here it is with the workaround:

elessar_109

Desktop (please complete the following information):

  • OS: Raspbian GNU/Linux 9.6 (stretch) (headless)
  • Browser: (none)
  • Version [e.g. 22] ArchiveBox commit hash: 33942d37cb

Smartphone (please complete the following information):

  • Device: n/a
  • OS: n/a
  • Browser n/a
  • Version [e.g. 22] n/a

Additional context
Add any other context about the problem here.

Originally created by @sbrl on GitHub (Jan 12, 2019). Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/129 **Describe the bug** A clear and concise description of what the bug is. I've noticed that the value of the `WGET_USER_AGENT` environment variable is not properly quoted by _ArchiveBox_. For example, I'm setting it to this in bash: ```bash export WGET_USER_AGENT="ArchiveBox/$(git rev-parse HEAD | head -c7) (+https://github.com/pirate/ArchiveBox/) wget/$(wget --version | head -n1 | cut -d" " -f3)"; # Then call ArchiveBox as normal ./archivebox .... ``` This should result in something like `ArchiveBox/7890abc (+https://github.com/pirate/ArchiveBox/) wget/1.18`. The above causes a bogus _404 Not Found_ error on every request. However, changing it to this: ```bash export WGET_USER_AGENT="\"ArchiveBox/$(git rev-parse HEAD | head -c7) (+https://github.com/pirate/ArchiveBox/) wget/$(wget --version | head -n1 | cut -d" " -f3)\""; # Then call ArchiveBox as normal ./archivebox ``` ....solves the issue. **Expected behavior** A clear and concise description of what you expected to happen. I shouldn't have to add the quotes manually myself in the `WGET_USER_AGENT` environment variable **Screenshots** If applicable, add screenshots to help explain your problem. Here it is not working: ![elessar_108](https://user-images.githubusercontent.com/9929737/51066576-ff457b00-1602-11e9-9575-295e72720b8c.png) Here it is with the workaround: ![elessar_109](https://user-images.githubusercontent.com/9929737/51066595-13897800-1603-11e9-9a26-9d0eb0a0974d.png) **Desktop (please complete the following information):** - OS: Raspbian GNU/Linux 9.6 (stretch) (headless) - Browser: (none) - Version [e.g. 22] ArchiveBox commit hash: 33942d37cb8b919215af03bf8aafe5443445a063 **Smartphone (please complete the following information):** - Device: n/a - OS: n/a - Browser n/a - Version [e.g. 22] n/a **Additional context** Add any other context about the problem here.
kerem 2026-03-14 21:03:36 +03:00
Author
Owner

@pirate commented on GitHub (Jan 12, 2019):

Thanks for the beautiful bug report! Fixed in b77476c, let me know if you're still having trouble and I'll re-open it.

<!-- gh-comment-id:453703776 --> @pirate commented on GitHub (Jan 12, 2019): Thanks for the beautiful bug report! Fixed in b77476c, let me know if you're still having trouble and I'll re-open it.
Author
Owner

@sbrl commented on GitHub (Jan 12, 2019):

Yep - looks like that did the trick. Thanks! :D

<!-- gh-comment-id:453737914 --> @sbrl commented on GitHub (Jan 12, 2019): Yep - looks like that did the trick. Thanks! :D
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ArchiveBox#3106
No description provided.