Skip to content

Commit 42a18bd

Browse files
authored
Merge pull request majlis-erc#755 from evolvedbinary/bugfix/ab-submit
Fix issues that were preventing submission to GitHub
2 parents c3257a6 + 2277e6f commit 42a18bd

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

services/git-commit.xql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ declare function gitcommit:step1($data as item()*,$path as xs:string?, $commit-m
8484

8585
declare function gitcommit:step2($data as item()*,$path as xs:string?, $commit-message as xs:string?, $branch-sha as xs:string?){
8686
(: 2. create a new branch :)
87-
let $branch-name := concat(replace($path,'/|\.',''),'-',replace(util:random(),'\.',''))
87+
let $branch-name := concat(replace($path,'/|\.',''),'-',replace(xs:string(util:random()),'\.',''))
8888
let $new-branch-name :=
8989
serialize(
9090
<object>

services/submit.xql

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ declare function local:transform($nodes as node()*) as item()* {
8989
for $n in $node/node()
9090
return local:transform($n)
9191
}
92-
else element {fn:QName("http://www.tei-c.org/ns/1.0",local-name($node))} {($node/@*, local:markdown2TEI($node/node()))}
92+
else
93+
local:passthru($node)
9394
case element(tei:editor) return
9495
if($node/parent::tei:titleStmt) then
9596
if($user != 'guest') then
@@ -354,10 +355,13 @@ return
354355
return
355356
<response status="okay" code="200"><message>{$save} Record {$id} saved, thank you for your contribution. </message></response>
356357
} catch * {
357-
(response:set-status-code( 500 ),
358-
<response status="fail">
359-
<message>Failed to update resource {$id}: {concat($err:code, ": ", $err:description)}</message>
360-
</response>)
358+
(
359+
util:log("ERROR", concat("Failed to update resource: ", $id, ". [", $err:line-number, ":", $err:column-number, "]", $err:module, ": ", $err:code, " ", $err:description)),
360+
response:set-status-code(500),
361+
<response status="fail">
362+
<message>Failed to update resource: {$id}. {concat($err:code, ": ", $err:description)}</message>
363+
</response>
364+
)
361365
}
362366
else if(request:get-parameter('type', '') = 'github') then
363367
try {
@@ -371,11 +375,13 @@ return
371375
</response>
372376
)
373377
} catch * {
374-
(response:set-status-code( 500 ),
375-
<response status="fail">
376-
<message>Failed to submit, please download your changes and send via email. {concat($err:code, ": ", $err:description)}</message>
377-
378-
</response>)
378+
(
379+
util:log("ERROR", concat("Failed to submit, please download your changes and send via email. [", $err:line-number, ":", $err:column-number, "]", $err:module, ": ", $err:code, " ", $err:description)),
380+
response:set-status-code(500),
381+
<response status="fail">
382+
<message>Failed to submit, please download your changes and send via email. {concat($err:code, ": ", $err:description)}</message>
383+
</response>
384+
)
379385
}
380386
else if(request:get-parameter('type', '') = 'download') then
381387
(response:set-header("Content-Type", "application/xml; charset=utf-8"),

0 commit comments

Comments
 (0)