app / com.otago.open / PDFOperations / determinePath

determinePath

fun determinePath(onPageUrl: String, href: String): String

Determines where a href on a page given by onPageUrl should point, if onPageUrl is a file (i.e. no forward slash), otherwise when in the folder given by onPageUrl it determines where the sub-resource would be located

If href starts with a "/" we just return the href relative to the COSC website

If href is a https link we just return it, if it starts with http we make it a https link

This method does not have any special handling for any .. or repeated ././

Parameters

onPageUrl - The page that the link is on, or the folder that the href is relative to

href - The href

Return
Where href should point if it appears on a page onPageUrl, or if it is a sub-resource of a folder onPageUrl