Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
reruin committed Nov 19, 2019
1 parent b46d84d commit f857f3f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions plugins/drive.odb.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ module.exports = ({ request, cache, getConfig }) => {

// folder => files
const folder = async (id) => {

const resid = `${defaultProtocol}:${id}`

let resp = { id, type: 'folder', protocol: defaultProtocol }
Expand All @@ -80,12 +79,15 @@ module.exports = ({ request, cache, getConfig }) => {
const [cookie, directUrl] = await getClient(rootId)


let url = baseUrl + encodeURI(path)

if (directUrl) {
url = baseUrl + directUrl.replace(baseUrl,'')
let url
if( path ){
url = baseUrl + encodeURI(path)
}else{
if (directUrl) {
url = baseUrl + directUrl.replace(baseUrl,'')
}
}

let res = await request.get(url, { headers: { 'Cookie': cookie } })
let code = (res.body.match(/g_listData\s*=\s*([\w\W]+)(?=;if)/) || ['', ''])[1]
let data = code.toString(16)
Expand All @@ -99,6 +101,7 @@ module.exports = ({ request, cache, getConfig }) => {
data = []
}
}
console.log('result',data.length )

let children = data ? data.map((i) => {
return {
Expand All @@ -113,7 +116,6 @@ module.exports = ({ request, cache, getConfig }) => {
}
}) : []


//folder 额外保存
resp.children = children
resp.$cached_at = Date.now()
Expand Down

0 comments on commit f857f3f

Please sign in to comment.