Skip to content

Commit 9e9ec0d

Browse files
committed
Fix drag-and-drop upload
1 parent 0ad9bb0 commit 9e9ec0d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/pages/home/folder/List.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import { OrderBy } from "~/store"
1313
import { Col, cols, ListItem } from "./ListItem"
1414
import { ItemCheckbox, useSelectWithMouse } from "./helper"
1515
import { bus } from "~/utils"
16+
import { UserMethods, UserPermissions } from "~/types"
17+
import { me } from "~/store"
18+
import { getCurrentPath } from "~/store/obj"
1619

1720
export const ListTitle = (props: {
1821
sortCallback: (orderBy: OrderBy, reverse?: boolean) => void
@@ -78,6 +81,12 @@ export const ListTitle = (props: {
7881

7982
const ListLayout = () => {
8083
const onDragOver = (e: DragEvent) => {
84+
// 拖拽上传做权限检查限制
85+
const writeIndex = UserPermissions.findIndex((item) => item === "write")
86+
if (!UserMethods.can(me(), writeIndex, getCurrentPath())) {
87+
return
88+
}
89+
8190
const items = Array.from(e.dataTransfer?.items ?? [])
8291
for (let i = 0; i < items.length; i++) {
8392
const item = items[i]

0 commit comments

Comments
 (0)