Check-in by ben on 2025-11-09 05:17:04

 Some items have an uploader name with no id nor email.  In that
 case, show a name without any search for other items by the same
 uploader.

 INSERTED    DELETED
       13          6 src/details.m4
       13          6 TOTAL over 1 changed file

Index: src/details.m4
==================================================================
--- src/details.m4
+++ src/details.m4
@@ -14,11 +14,12 @@
incl(src/web.awk)

function main(     add_date, col, cols, cmd, creator, descr, dir, i,
    iaout, id, item_id, item_server, item_size, label, language,
    license, output, pub_date, scanner, signature, str, thumb,
-    title, topic, topics, type, uploader_account, uploader_email, url)
+    title, topic, topics, type, uploader_account, uploader_email,
+    uploader_name, url)
{
    item_id = search

    signature = "details/" item_id
    str = cache_init(signature)
@@ -55,10 +56,12 @@
    topics = 0
    delete topic
    type = ""
    uploader_account = ""
    uploader_email = ""
+    uploader_name = "Unknown"
+
    while ((cmd | getline) > 0) {
        if ($1 == ".dir" && $2 == "s") {
            dir = $3
        } else if ($1 == ".files[].name" && $2 == "s") {
            if ($3 == "__ia_thumb.jpg") {
@@ -176,14 +179,16 @@

    # scrape uploader name from item web page HTML
    url = api_ssl_endpoint "/details/" item_id
    api_request(url, "GET", iaout)
    while ((getline <iaout) > 0) {
-        if (/item-upload-info__uploader-name/ &&
-            match($0, /\/details\/[^"]*"/))
-        {
-            uploader_account = substr($0, RSTART + 9, RLENGTH - 10)
+        if (match($0, /item-upload-info__uploader-name/)) {
+            if (match($0, /\/details\/[^"]*"/)) {
+                uploader_account = substr($0, RSTART + 9, RLENGTH - 10)
+            } else if (match($0, />[^<]*<\/span>/)) {
+                uploader_name = substr($0, RSTART + 1, RLENGTH - 8)
+            }
        }
    }
    close(iaout)

    if (cols > 0) {
@@ -200,14 +205,16 @@
    print "# Uploaded by" >>output
    if (length(uploader_account) > 0) {
        label = shorten(uploader_account, 70)
        printf "1%s\t%s/account?%s/%s\t%s\t%s\n", label, cgipath,
            uploader_account, uploader_email, server, port >>output
-    } else {
+    } else if (length(uploader_email) > 0) {
        label = shorten(uploader_email, 70)
        printf "1%s\t%s/search?uploader:%s\t%s\t%s\n", label,
            cgipath, uploader_email, server, port >>output
+    } else {
+        printf "%s\n", uploader_name >>output
    }

    print "" >>output
    print "# Similar items" >>output
    printf "1View similar items\t%s/search?similar:%s\t%s\t%s\n",