Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docket: fix glob handling (again) #245

Merged
merged 6 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions desk/app/docket.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@
++ handle-http-request
|= [eyre-id=@ta inbound-request:eyre]
^- (quip card _state)
~& authenticated/authenticated
arthyn marked this conversation as resolved.
Show resolved Hide resolved
::
=; [payload=simple-payload:http caz=(list card) =_state]
:_ state
Expand Down Expand Up @@ -671,15 +672,17 @@
++ split-at
=| fst=tape
|= [=tape char=@tD]
=. tape (flop tape)
|-
^+ [fst fst]
?~ tape [fst tape]
?~ tape [(flop fst) (flop tape)]
?: =(i.tape char)
[fst t.tape]
[(flop fst) (flop t.tape)]
$(tape t.tape, fst (snoc fst i.tape))
::
++ fip
|= fil=@t
=/ [fil=tape ext=tape] (split-at (trip fil) '.')
=/ [ext=tape fil=tape] (split-at (trip fil) '.')
=- (snoc - (crip ext))
%+ turn
(scan fil (most fas (star ;~(less fas next))))
Expand Down Expand Up @@ -712,7 +715,8 @@
?: =(suffix /desk/js)
%- inline-js-response
(rap 3 'window.desk = "' u.des '";' ~)
=. suffix (turn suffix |=(s=@t (crip (en-urlt:html (trip s)))))
=? suffix !(~(has by glob) suffix)
(turn suffix |=(s=@t (crip (en-urlt:html (trip s)))))
=/ requested
?: (~(has by glob) suffix) suffix
/index/html
Expand Down
7 changes: 6 additions & 1 deletion desk/ted/make-glob.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
%+ turn paths
|= pax=path
^- [path mime]
:- (slag (lent dir) pax)
:-
?> ?=(^ pax)
%+ turn t.pax
|= seg=@t
^- @t
(crip (en-urlt:html (trip seg)))
=/ mar=mark (rear pax)
=+ .^(vas=vase %cr (weld home pax))
=+ .^(=tube:clay %cc (weld home /[mar]/mime))
Expand Down