Patch files to prevent fetching urls even if file exists, adjust mime types for server
This commit is contained in:
parent
719019d62d
commit
85bd2ff4da
10
files.sh
10
files.sh
|
@ -34,10 +34,6 @@ fetchFileURL() {
|
|||
}
|
||||
|
||||
fetchFile () {
|
||||
uri=$(fetchFileURL "${1}")
|
||||
if [[ "${uri}" == "" ]]; then
|
||||
return 1
|
||||
fi
|
||||
RESULT_PATH="${PAGE_PATH}${1}.${3}"
|
||||
|
||||
if [[ -f "${RESULT_PATH}" ]]; then
|
||||
|
@ -47,7 +43,11 @@ fetchFile () {
|
|||
fi
|
||||
fi
|
||||
|
||||
echo "${uri}" >&2
|
||||
uri=$(fetchFileURL "${1}")
|
||||
if [[ "${uri}" == "" ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
doFullRequest "${uri}" > .files.tmp
|
||||
if [[ $(isValidPageResult .files.tmp) == "yes" ]]; then
|
||||
mv .files.tmp "${RESULT_PATH}"
|
||||
|
|
|
@ -1023,7 +1023,11 @@ func main() {
|
|||
byteEntries, _ := json.Marshal(dirEntries)
|
||||
writer.Write(byteEntries)
|
||||
} else {
|
||||
writer.Header().Set("Content-Type", "text/plain")
|
||||
if path.Ext(filePath) == ".wiki" {
|
||||
writer.Header().Set("Content-Type", "text/plain")
|
||||
} else if path.Ext(filePath) == ".md" {
|
||||
writer.Header().Set("Content-Type", "text/markdown")
|
||||
}
|
||||
http.ServeFile(writer, request, filePath)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue