Skip to content

Commit 9fc3933

Browse files
authored
Merge pull request #554 from HistoryAtState/fix-frus-interior-404
Restore 404s for bad volume interior requests
2 parents 214b362 + cef87c9 commit 9fc3933

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

modules/pages.xqm

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,26 +114,16 @@ declare function pages:load-xml($publication-config as map(*), $document-id as x
114114

115115
return
116116
if (empty($block) and not($ignore)) then (
117-
pages:load-fallback-page($document-id, $section-id)
117+
request:set-attribute("hsg-shell.errcode", 404),
118+
request:set-attribute("hsg-shell.path", string-join(($document-id, $section-id), "/")),
119+
error(QName("http://history.state.gov/ns/site/hsg", "not-found"), "document " || $document-id || " section " || $section-id || " not found")
118120
) else (
119121
util:log("debug", ("pages:load-xml: Loaded ", document-uri(root($block)), ". Node name: ", node-name($block), ".")),
120122
$block
121123
)
122124
)
123125
};
124126

125-
declare function pages:load-fallback-page($document-id as xs:string?, $section-id as xs:string?) {
126-
util:log("debug", ("Loading fallback page for ", $document-id)),
127-
let $volume := $config:FRUS_COL_VOLUMES/id($document-id)
128-
return
129-
if (empty($volume)) then (
130-
request:set-attribute("hsg-shell.errcode", 404),
131-
request:set-attribute("hsg-shell.path", string-join(($document-id, $section-id), "/")),
132-
error(QName("http://history.state.gov/ns/site/hsg", "not-found"), "document " || $document-id || " section " || $section-id || " not found")
133-
) else
134-
pages:volume-to-tei($volume)
135-
};
136-
137127
(: TODO delete after completing import of external location data and deciding on whether to keep summary data or not :)
138128
declare function pages:volume-to-tei($volume as element()) {
139129
<tei:TEI xmlns:frus="http://history.state.gov/frus/ns/1.0" xml:id="{$volume/@xml:id}">

0 commit comments

Comments
 (0)