Skip to content

Commit

Permalink
Fix npe
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangao authored and zhangao committed Jun 17, 2023
1 parent 3050289 commit 7332eaf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/aliapi/album.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ export default class AliAlbum {
image_url_process: "image/resize,w_1920/format,jpeg",
limit: limited,
marker:marker,
order_by: "file_image_time",
order_direction: "DESC"
}
const results:AliAlbumFileInfo[] = []
Expand Down
11 changes: 0 additions & 11 deletions src/aliapi/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,18 +302,7 @@ export default class AliFile {
static async ApiGetFile(user_id: string, drive_id: string, file_id: string): Promise<IAliGetFileModel | undefined> {
if (!user_id || !drive_id || !file_id) return undefined
const fileItem = await AliFile.ApiFileInfoOpenApi(user_id, drive_id, file_id);

if (fileItem) {
if (fileItem.type === 'file') {
const fileDetails = await AliFile.ApiFileInfoOpenApi(user_id, drive_id, fileItem.file_id);
fileItem.thumbnail = fileDetails?.thumbnail
fileItem.url = fileDetails?.url || fileItem.url
fileItem.download_url = fileDetails?.download_url || fileItem.download_url
fileItem.starred = fileDetails?.starred || fileItem.starred
fileItem.trashed = fileDetails?.trashed || fileItem.trashed
fileItem.deleted = fileDetails?.deleted || fileItem.deleted
fileItem.description = fileDetails?.description || fileItem.description
}
return AliDirFileList.getFileInfo(fileItem, '')
}
return undefined
Expand Down
3 changes: 3 additions & 0 deletions src/aliapi/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,15 @@ export default class ServerHttp {
&& fileData.name.indexOf(process.arch) > 0
&& fileData.name.endsWith('.exe')) {
updateData = fileData
break
} else if (platform === 'darwin'
&& fileData.name.indexOf(process.arch) > 0
&& fileData.name.endsWith('.dmg')) {
updateData = fileData
break
} else if (fileData.name.endsWith('.asar')) {
asarFileUrl = 'https://ghproxy.com/' + fileData.url
break
}
}
if (tagName) {
Expand Down
18 changes: 11 additions & 7 deletions src/pic/Content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,19 @@ export default {
if (this.base_name === 'all') {
const photos = await AliAlbum.ApiLimitedPhotos(this.next_marker, PHOTO_PER_PAGE)
this.next_marker = photos[0].next_marker || ''
this.photo_list.push(...photos)
if (photos.length > 0) {
this.next_marker = photos[0].next_marker || ''
this.photo_list.push(...photos)
}
} else {
const photos = await AliAlbum.ApiAlbumListFiles(this.base_name, this.next_marker, PHOTO_PER_PAGE)
this.next_marker = photos[0].next_marker || ''
photos.forEach((photo) => {
photo.album_name = this.album_friendly_name
})
this.photo_list.push(...photos)
if (photos.length > 0) {
this.next_marker = photos[0].next_marker || ''
photos.forEach((photo) => {
photo.album_name = this.album_friendly_name
})
this.photo_list.push(...photos)
}
}
this.current_page_to_load++;
},
Expand Down

0 comments on commit 7332eaf

Please sign in to comment.