|
|
|
@ -53,13 +53,12 @@ export class Frontend {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async loadFile(user, repo, commit, src, dest) {
|
|
|
|
async loadFile(user, repo, commit, src, dest) {
|
|
|
|
const url = this.rawUrl(user, repo, commit, dest)
|
|
|
|
const url = this.rawUrl(user, repo, commit, src)
|
|
|
|
const resp = await fetch(url)
|
|
|
|
const resp = await fetch(url)
|
|
|
|
this.checkOk(resp)
|
|
|
|
this.checkOk(resp)
|
|
|
|
const body = await resp.arrayBuffer()
|
|
|
|
const body = await resp.arrayBuffer()
|
|
|
|
const ext = dest.at('-1')?.match?.(/\.(\w+)$/)?.[1]
|
|
|
|
const ext = dest.at('-1')?.match?.(/\.(\w+)$/)?.[1]
|
|
|
|
const contentType = this.contentTypes[ext]
|
|
|
|
const contentType = this.contentTypes[ext]
|
|
|
|
console.log({ext, contentType})
|
|
|
|
|
|
|
|
this.files[this.pathString(dest)] = {
|
|
|
|
this.files[this.pathString(dest)] = {
|
|
|
|
user,
|
|
|
|
user,
|
|
|
|
repo,
|
|
|
|
repo,
|
|
|
|
|