surf

surf
git clone git@git.zachrice.app:repos/surf.git
Log | Files | Refs | README | LICENSE

surf-download-emptyuri.patch (656B)


      1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
      2 From: Zach Rice <bynxmusic@gmail.com>
      3 Date: Sun, 18 May 2026 00:00:00 +0000
      4 Subject: [PATCH] Skip download when URI is empty
      5 
      6 WebKit sometimes fires a download response with an empty URI (e.g.
      7 on YouTube). This passes an empty string to curl which errors out.
      8 Guard against it by returning early.
      9 
     10 diff --git a/surf.c b/surf.c
     11 --- a/surf.c
     12 +++ b/surf.c
     13 @@ -1819,6 +1819,10 @@ void
     14  download(Client *c, WebKitURIResponse *r)
     15  {
     16  	const char *dluri = webkit_uri_response_get_uri(r);
     17 +
     18 +	if (!dluri || !dluri[0])
     19 +		return;
     20 +
     21  	Arg a = (Arg)DOWNLOAD(dluri, geturi(c));
     22  	spawn(c, &a);
     23  }