commit 7e668d9

grunfink  ·  2026-04-02 14:14:34 +0000 UTC
parent aed115a
Also exclude emojis served from static directories.
1 files changed,  +12, -3
M data.c
M data.c
+12, -3
 1@@ -4265,7 +4265,7 @@ void purge_static(snac *user)
 2     xs *spec = xs_fmt("%s/static/""*", user->basedir);
 3     xs *fns = xs_glob(spec, 1, 0);
 4     xs *files = xs_dict_new();
 5-    const char *v;
 6+    const char *k, *v;
 7     int cnt = 0;
 8 
 9     /* fill a dict with the static resource urls */
10@@ -4302,6 +4302,17 @@ void purge_static(snac *user)
11         snac_debug(user, 2, xs_fmt("purge_static: excluding '%s'", v));
12     }
13 
14+    /* exclude emojis served from the static directory */
15+    xs *emo = emojis();
16+    xs_dict_foreach(emo, k, v) {
17+        if (xs_dict_get(files, v)) {
18+            files = xs_dict_del(files, v);
19+            cnt--;
20+
21+            snac_debug(user, 2, xs_fmt("purge_static: excluding '%s'", v));
22+        }
23+    }
24+
25     if (cnt <= 0)
26         return;
27 
28@@ -4350,8 +4361,6 @@ void purge_static(snac *user)
29     }
30 
31     /* what is left in the files dict is not referenced anywhere */
32-    const char *k;
33-
34     xs_dict_foreach(files, k, v) {
35         xs *s = xs_fmt("%s/static/%s", user->basedir, v);
36         snac_debug(user, 1, xs_fmt("purge_static: %s", s));