aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2025-10-10 11:20:25 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2025-10-10 11:20:25 +0200
commit4fa8915c8cd42b8bc30df3714e5163c4f4bece89 (patch)
tree38c292257cd57617f1782fe9261f0367f700bf6b
parent942559d321551e93cd6bae0b03de03e7cc13042c (diff)
downloadslcl-4fa8915c8cd42b8bc30df3714e5163c4f4bece89.tar.gz
page.c: Ensure trailing '/' on dir download URLs
Otherwise, it is not ensured web browsers would translate a relative directory such as "dir/.." to a URL with a trailing '/'. Therefore, a POST request to "/user?download=1" would fail because slcl only considers "/user/" (note the trailing '/') as valid.
-rw-r--r--page.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/page.c b/page.c
index 237a791..5a34c22 100644
--- a/page.c
+++ b/page.c
@@ -416,7 +416,7 @@ static int prepare_download(struct html_node *const n,
{
dynstr_free(&d);
- if (dynstr_append(&d, "%s?download=1", encurl))
+ if (dynstr_append(&d, "%s/?download=1", encurl))
{
fprintf(stderr, "%s: dynstr_append encurl dir failed\n", __func__);
goto end;