42links

Check-in [512b41f766]
Login

Check-in [512b41f766]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:simplified URI scheme check when adding a link
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA3-256: 512b41f766b9624bb74ab3db6f3b634a42a5ca916a62e96aac4713a50dc4a531
User & Date: Cthulhux 2025-06-17 01:00:18
Context
2025-06-17
01:00
simplified URI scheme check when adding a link ... (Leaf check-in: 512b41f766 user: Cthulhux tags: trunk)
2025-06-15
21:06
release 1.7.0 with improved Gopher support, trying to fetch the title now automatically. ... (check-in: 8c4f336219 user: Cthulhux tags: release-1.7.0, trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/database.lisp.

474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
          "No URL = no action. Try again!"

          (if parse-error
              ;; The URL fetcher had already received an error. Halt and catch fire :-):
              parse-error
              
              (let ((scheme (quri:uri-scheme (quri:uri url))))
                (if (not (or
                          (string= (quri:uri-scheme (quri:uri url)) "http")
                          (string= (quri:uri-scheme (quri:uri url)) "https")
                          (string= (quri:uri-scheme (quri:uri url)) "gopher")))
                    ;; Do nothing for links that are neither HTTP(S) nor Gopher:
                    "42links only supports HTTP, HTTPS, and Gopher links right now. Patches welcome!"
                    
                    ;; Do nothing if we already have the link:
                    (if (postmodern:query (:select 'uid :from 'links :where (:= 'url url)) :single)
                        "You already added this link. Once is enough. :-)"
                        







|
<
<
<







474
475
476
477
478
479
480
481



482
483
484
485
486
487
488
          "No URL = no action. Try again!"

          (if parse-error
              ;; The URL fetcher had already received an error. Halt and catch fire :-):
              parse-error
              
              (let ((scheme (quri:uri-scheme (quri:uri url))))
                (if (not (find scheme (list "http" "https" "gopher") :test #'equalp))



                    ;; Do nothing for links that are neither HTTP(S) nor Gopher:
                    "42links only supports HTTP, HTTPS, and Gopher links right now. Patches welcome!"
                    
                    ;; Do nothing if we already have the link:
                    (if (postmodern:query (:select 'uid :from 'links :where (:= 'url url)) :single)
                        "You already added this link. Once is enough. :-)"