Skip to content

Commit

Permalink
Merge pull request #34 from joewiz/fix/old-versions-lookup
Browse files Browse the repository at this point in the history
Fix failed lookup of packages compatible with older versions of eXist
  • Loading branch information
wolfgangmm authored Feb 23, 2019
2 parents 1d350f7 + 762a35f commit f679efa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
16 changes: 13 additions & 3 deletions modules/app.xql
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,21 @@ declare function app:view-package($node as node(), $model as map(*), $mode as xs
response:redirect-to(xs:anyURI($info-url))
(: view current package info :)
else
let $compatible-xar := app:find-version($app, $procVersion, (), (), (), ())
let $package := $app[@path eq $compatible-xar]
let $app-versions := ($app, $app/other/version)
let $compatible-xar := app:find-version($app-versions, $procVersion, (), (), (), ())
let $package := $app-versions[@path eq $compatible-xar]
let $show-details := true()
return
app:package-to-list-item($package, $show-details)
if (exists($package)) then
app:package-to-list-item($package, $show-details)
else
(
response:set-status-code(404),
if (exists($app)) then
<li class="package text-warning">Package {$abbrev} requires a newer version of eXist.</li>
else
<li class="package text-warning">No package {$abbrev} is available.</li>
)
};

declare function app:package-to-list-item($app as element(app), $show-details as xs:boolean) {
Expand Down
5 changes: 3 additions & 2 deletions modules/find.xql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ let $app :=
collection($config:app-root || "/public")//app[name eq $name]
else
collection($config:app-root || "/public")//app[abbrev eq $abbrev]
let $compatible-xar := app:find-version($app | $app/other/version, $procVersion, $version, $semVer, $minVersion, $maxVersion)
let $app-versions := ($app, $app/other/version)
let $compatible-xar := app:find-version($app-versions, $procVersion, $version, $semVer, $minVersion, $maxVersion)
return
if ($compatible-xar) then
let $rel-public :=
Expand All @@ -31,7 +32,7 @@ return
"public/"
return
if ($info) then
<found>{$app}</found>
<found>{$compatible-xar}</found>
else if ($zip) then
response:redirect-to(xs:anyURI($rel-public || $compatible-xar || ".zip"))
else
Expand Down
2 changes: 1 addition & 1 deletion modules/scan.xql
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ declare function scanrepo:process($apps as element(app)*) {
let $n := tokenize($older/version, "\.") ! xs:int(analyze-string(., "(\d+)")//fn:group[1])
order by $n[1], $n[2], $n[3]
return
<version version="{$older/version}">{$older/@path}</version>
<version version="{$older/version}">{$older/@path, $older/requires}</version>
)
}
</other>
Expand Down

0 comments on commit f679efa

Please sign in to comment.