Skip to content

Commit

Permalink
Merge pull request #53 from ashesofdream/main
Browse files Browse the repository at this point in the history
fix folder delete
  • Loading branch information
traceless committed Mar 7, 2024
2 parents a439f79 + 39db142 commit 13b91cb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 26 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
name: release_docker

on:
workflow_dispatch:
push:
branches: ["main","release"]
paths:
- 'node-proxy/**'
pull_request:
branches: [ 'main' ]
paths:
- 'node-proxy/**'

jobs:
release_docker:
Expand All @@ -20,24 +27,12 @@ jobs:
cd node-proxy
npm install && npm run build
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ secrets.DOCKERHUB_NAME }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: wangjinhai68
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
Expand All @@ -46,4 +41,4 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: linux/amd64,linux/arm64,linux/arm/v7
28 changes: 15 additions & 13 deletions node-proxy/src/encDavHandle.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,22 @@ const handle = async (ctx, next) => {
const fileName = path.basename(url)
const realName = convertRealName(passwdInfo.password, passwdInfo.encType, url)
// maybe from aliyundrive, check this req url while get file list from enc folder
if (url.endsWith('/') && request.method.toLocaleUpperCase() === 'GET') {
if (url.endsWith('/') && 'GET,DELETE'.includes(request.method.toLocaleUpperCase())) {
let respBody = await httpClient(ctx.req, ctx.res)
const aurlArr = respBody.match(/href="[^"]*"/g)
// logger.debug('@@aurlArr', aurlArr)
if (aurlArr && aurlArr.length) {
for (let urlStr of aurlArr) {
urlStr = urlStr.replace('href="', '').replace('"', '')
const aurl = decodeURIComponent(urlStr.replace('href="', '').replace('"', ''))
const baseUrl = decodeURIComponent(url)
if (aurl.includes(baseUrl)) {
const fileName = path.basename(aurl)
const showName = convertShowName(passwdInfo.password, passwdInfo.encType, fileName)
logger.debug('@@aurl', urlStr, showName)
respBody = respBody.replace(path.basename(urlStr), encodeURI(showName)).replace(fileName, showName)
if(request.method.toLocaleUpperCase() === 'GET'){
const aurlArr = respBody.match(/href="[^"]*"/g)
// logger.debug('@@aurlArr', aurlArr)
if (aurlArr && aurlArr.length) {
for (let urlStr of aurlArr) {
urlStr = urlStr.replace('href="', '').replace('"', '')
const aurl = decodeURIComponent(urlStr.replace('href="', '').replace('"', ''))
const baseUrl = decodeURIComponent(url)
if (aurl.includes(baseUrl)) {
const fileName = path.basename(aurl)
const showName = convertShowName(passwdInfo.password, passwdInfo.encType, fileName)
logger.debug('@@aurl', urlStr, showName)
respBody = respBody.replace(path.basename(urlStr), encodeURI(showName)).replace(fileName, showName)
}
}
}
}
Expand Down

0 comments on commit 13b91cb

Please sign in to comment.