otherjoel / splitflap

🔖⚛️ RSS / Atom feed generation library for Racket
Other
22 stars 2 forks source link

`file->enclosure` broken on Windows #13

Closed otherjoel closed 11 months ago

otherjoel commented 11 months ago
#lang racket

(require splitflap)

(define audio-file (make-temporary-file "audio-~a.m4a"))
(display-to-file (make-bytes 100 66) audio-file #:exists 'truncate)
(display
   (express-xml (file->enclosure audio-file "http://example.com") 'atom))
(delete-file audio-file)

On Windows, this code results in:

enclosure, field 1: contract violation
  expected: a URL that includes a valid scheme and a valid RFC 1035 domain as the host
  given: "http://example.com\\audio-17012888341701288834299.m4a"
  in: valid-url-string?
  contract from: 
      <pkgs>/splitflap-lib/private/validation.rkt
  blaming: <pkgs>/splitflap-lib/private/validation.rkt
   (assuming the contract is correct)
  at: <pkgs>/splitflap-lib/private/validation.rkt:286:10

Among other things, this bug is triggered when docs are built after installing the package.