From af6d5594843cc03b74eeb2a89998e2f1e0318d15 Mon Sep 17 00:00:00 2001 From: jmal Date: Wed, 15 May 2024 19:02:16 +0800 Subject: [PATCH 01/27] Update nightly-nvidia-build.yml --- .github/workflows/nightly-nvidia-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly-nvidia-build.yml b/.github/workflows/nightly-nvidia-build.yml index 9bacc52a..45014fe0 100644 --- a/.github/workflows/nightly-nvidia-build.yml +++ b/.github/workflows/nightly-nvidia-build.yml @@ -2,7 +2,7 @@ name: Build nightly (nvidia) on: push: - branches: [ master ] + branches: [ * ] workflow_dispatch: jobs: From b89f511f1a6cac0c03211212735747e74de238fd Mon Sep 17 00:00:00 2001 From: jmal Date: Wed, 15 May 2024 19:02:31 +0800 Subject: [PATCH 02/27] Update nightly-build.yml --- .github/workflows/nightly-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 58bfcf9b..51a14e8f 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -2,7 +2,7 @@ name: Build nightly on: push: - branches: [ master ] + branches: [ * ] workflow_dispatch: jobs: From 43e79a7283f882b12c7a15ee6123366200bfe888 Mon Sep 17 00:00:00 2001 From: jmal Date: Wed, 15 May 2024 19:03:51 +0800 Subject: [PATCH 03/27] Update nightly-build.yml --- .github/workflows/nightly-build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 51a14e8f..310c0878 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -2,7 +2,8 @@ name: Build nightly on: push: - branches: [ * ] + branches: + - '*' workflow_dispatch: jobs: From 80a22fdd8dfa8e64ceacf2e4f4bc6caa5bb33553 Mon Sep 17 00:00:00 2001 From: jmal Date: Wed, 15 May 2024 19:04:08 +0800 Subject: [PATCH 04/27] Update nightly-nvidia-build.yml --- .github/workflows/nightly-nvidia-build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly-nvidia-build.yml b/.github/workflows/nightly-nvidia-build.yml index 45014fe0..a9bbc1a7 100644 --- a/.github/workflows/nightly-nvidia-build.yml +++ b/.github/workflows/nightly-nvidia-build.yml @@ -2,7 +2,8 @@ name: Build nightly (nvidia) on: push: - branches: [ * ] + branches: + - '*' workflow_dispatch: jobs: From 40d4cc6c11df9cc56d2d95ebcbd41c28b0269b46 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 17:00:14 +0800 Subject: [PATCH 05/27] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96webDAV=20PROPPAT?= =?UTF-8?q?CH=20=E6=96=B9=E6=B3=95=20Resolve[#90](https://github.com/jameb?= =?UTF-8?q?al/jmal-cloud-view/issues/90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jmal/clouddisk/webdav/WebdavServlet.java | 172 +++++++++++------- 1 file changed, 103 insertions(+), 69 deletions(-) diff --git a/src/main/java/com/jmal/clouddisk/webdav/WebdavServlet.java b/src/main/java/com/jmal/clouddisk/webdav/WebdavServlet.java index 044cf9d1..6ae0bd26 100644 --- a/src/main/java/com/jmal/clouddisk/webdav/WebdavServlet.java +++ b/src/main/java/com/jmal/clouddisk/webdav/WebdavServlet.java @@ -119,6 +119,7 @@ */ public class WebdavServlet extends DefaultServlet { + @Serial private static final long serialVersionUID = 1L; @@ -315,23 +316,17 @@ protected void service(HttpServletRequest req, HttpServletResponse resp) throws log("[" + method + "] " + path); } - if (method.equals(METHOD_PROPFIND)) { - doPropfind(req, resp); - } else if (method.equals(METHOD_PROPPATCH)) { - doProppatch(req, resp); - } else if (method.equals(METHOD_MKCOL)) { - doMkcol(req, resp); - } else if (method.equals(METHOD_COPY)) { - doCopy(req, resp); - } else if (method.equals(METHOD_MOVE)) { - doMove(req, resp); - } else if (method.equals(METHOD_LOCK)) { - doLock(req, resp); - } else if (method.equals(METHOD_UNLOCK)) { - doUnlock(req, resp); - } else { - // DefaultServlet processing - super.service(req, resp); + switch (method) { + case METHOD_PROPFIND -> doPropfind(req, resp); + case METHOD_PROPPATCH -> doProppatch(req, resp); + case METHOD_MKCOL -> doMkcol(req, resp); + case METHOD_COPY -> doCopy(req, resp); + case METHOD_MOVE -> doMove(req, resp); + case METHOD_LOCK -> doLock(req, resp); + case METHOD_UNLOCK -> doUnlock(req, resp); + default -> + // DefaultServlet processing + super.service(req, resp); } } @@ -353,12 +348,9 @@ private boolean isSpecialPath(final String path) { protected boolean checkIfHeaders(HttpServletRequest request, HttpServletResponse response, WebResource resource) throws IOException { - if (!super.checkIfHeaders(request, response, resource)) { - return false; - } + return super.checkIfHeaders(request, response, resource); - // TODO : Checking the WebDAV If header - return true; + //Checking the WebDAV If header } @@ -389,7 +381,7 @@ protected String getRelativePath(HttpServletRequest request, boolean allowEmptyP if (pathInfo != null) { result.append(pathInfo); } - if (result.length() == 0) { + if (result.isEmpty()) { result.append('/'); } @@ -461,13 +453,12 @@ protected void doPropfind(HttpServletRequest req, HttpServletResponse resp) thro if (depthStr == null) { depth = maxDepth; } else { - if (depthStr.equals("0")) { - depth = 0; - } else if (depthStr.equals("1")) { - depth = 1; - } else if (depthStr.equals("infinity")) { - depth = maxDepth; - } + depth = switch (depthStr) { + case "0" -> 0; + case "1" -> 1; + case "infinity" -> maxDepth; + default -> depth; + }; } Node propNode = null; @@ -642,23 +633,74 @@ protected void doPropfind(HttpServletRequest req, HttpServletResponse resp) thro * @param req The Servlet request * @param resp The Servlet response * - * @throws IOException If an IO error occurs + * @throws IOException If an IO error occurs */ - protected void doProppatch(HttpServletRequest req, HttpServletResponse resp) throws IOException { - + protected void doProppatch(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { if (readOnly) { - resp.sendError(WebdavStatus.SC_FORBIDDEN); + resp.sendError(WebdavStatus.SC_FORBIDDEN, "Read-only mode is enabled."); return; } if (isLocked(req)) { - resp.sendError(WebdavStatus.SC_LOCKED); + resp.sendError(WebdavStatus.SC_LOCKED, "Resource is locked."); return; } - resp.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED); + String path = getRelativePath(req); + WebResource resource = resources.getResource(path); + + if (!resource.exists()) { + resp.sendError(WebdavStatus.SC_NOT_FOUND, "Resource not found."); + return; + } + + DocumentBuilder documentBuilder; + Document document; + try { + documentBuilder = getDocumentBuilder(); + document = documentBuilder.parse(new InputSource(req.getInputStream())); + } catch (SAXException | IOException e) { + resp.sendError(WebdavStatus.SC_BAD_REQUEST, "Error parsing XML request body."); + return; + } + + Element rootElement = document.getDocumentElement(); + NodeList setList = rootElement.getElementsByTagName("set"); + NodeList removeList = rootElement.getElementsByTagName("remove"); + + List successfulUpdates = new ArrayList<>(); + + processProppatchOperations(setList, successfulUpdates); + processProppatchOperations(removeList, successfulUpdates); + + if (!successfulUpdates.isEmpty()) { + resp.setStatus(WebdavStatus.SC_OK); + } else { + resp.setStatus(WebdavStatus.SC_MULTI_STATUS); + resp.setContentType("text/xml"); + XMLWriter generatedXML = new XMLWriter(resp.getWriter()); + generatedXML.writeXMLHeader(); + generatedXML.writeElement("D", DEFAULT_NAMESPACE, "multistatus", XMLWriter.OPENING); + generatedXML.writeElement("D", "multistatus", XMLWriter.CLOSING); + generatedXML.sendData(); + } } + private void processProppatchOperations(NodeList operationList, + List successfulUpdates) { + for (int i = 0; i < operationList.getLength(); i++) { + Node operationNode = operationList.item(i); + NodeList propList = operationNode.getChildNodes(); + + for (int j = 0; j < propList.getLength(); j++) { + Node propNode = propList.item(j); + if (propNode.getNodeType() == Node.ELEMENT_NODE) { + String propName = propNode.getNodeName(); + successfulUpdates.add(propName); + } + } + } + } /** * MKCOL Method. @@ -697,7 +739,7 @@ protected void doMkcol(HttpServletRequest req, HttpServletResponse resp) throws try { // Document document = documentBuilder.parse(new InputSource(req.getInputStream())); - // TODO : Process this request body + // Process this request body resp.sendError(WebdavStatus.SC_NOT_IMPLEMENTED); return; @@ -891,7 +933,7 @@ protected void doLock(HttpServletRequest req, HttpServletResponse resp) throws S lockDuration = MAX_TIMEOUT; } } - lock.expiresAt = System.currentTimeMillis() + (lockDuration * 1000); + lock.expiresAt = System.currentTimeMillis() + (lockDuration * 1000L); int lockRequestType = LOCK_CREATION; @@ -903,8 +945,7 @@ protected void doLock(HttpServletRequest req, HttpServletResponse resp) throws S Document document = documentBuilder.parse(new InputSource(req.getInputStream())); // Get the root element of the document - Element rootElement = document.getDocumentElement(); - lockInfoNode = rootElement; + lockInfoNode = document.getDocumentElement(); } catch (IOException | SAXException e) { lockRequestType = LOCK_REFRESH; } @@ -1475,11 +1516,7 @@ private boolean copyResource(HttpServletRequest req, HttpServletResponse resp) t boolean overwrite = true; String overwriteHeader = req.getHeader("Overwrite"); if (overwriteHeader != null) { - if (overwriteHeader.equalsIgnoreCase("T")) { - overwrite = true; - } else { - overwrite = false; - } + overwrite = overwriteHeader.equalsIgnoreCase("T"); } // Overwriting the destination @@ -1509,9 +1546,9 @@ private boolean copyResource(HttpServletRequest req, HttpServletResponse resp) t if ((!result) || (!errorList.isEmpty())) { if (errorList.size() == 1) { - resp.sendError(errorList.values().iterator().next().intValue()); + resp.sendError(errorList.values().iterator().next()); } else { - sendReport(req, resp, errorList); + sendReport(resp, errorList); } return false; } @@ -1552,7 +1589,7 @@ private boolean copyResource(Map errorList, String source, Strin if (!resources.mkdir(dest)) { WebResource destResource = resources.getResource(dest); if (!destResource.isDirectory()) { - errorList.put(dest, Integer.valueOf(WebdavStatus.SC_CONFLICT)); + errorList.put(dest, WebdavStatus.SC_CONFLICT); return false; } } @@ -1579,7 +1616,7 @@ private boolean copyResource(Map errorList, String source, Strin String parent = destResource.getWebappPath().substring(0, lastSlash); WebResource parentResource = resources.getResource(parent); if (!parentResource.isDirectory()) { - errorList.put(source, Integer.valueOf(WebdavStatus.SC_CONFLICT)); + errorList.put(source, WebdavStatus.SC_CONFLICT); return false; } } @@ -1593,14 +1630,14 @@ private boolean copyResource(Map errorList, String source, Strin } try (InputStream is = sourceResource.getInputStream()) { if (!resources.write(dest, is, false)) { - errorList.put(source, Integer.valueOf(WebdavStatus.SC_INTERNAL_SERVER_ERROR)); + errorList.put(source, WebdavStatus.SC_INTERNAL_SERVER_ERROR); return false; } } catch (IOException e) { log(sm.getString("webdavservlet.inputstreamclosefail", source), e); } } else { - errorList.put(source, Integer.valueOf(WebdavStatus.SC_INTERNAL_SERVER_ERROR)); + errorList.put(source, WebdavStatus.SC_INTERNAL_SERVER_ERROR); return false; } return true; @@ -1612,14 +1649,11 @@ private boolean copyResource(Map errorList, String source, Strin * * @param req Servlet request * @param resp Servlet response - * - * @return true if the delete is successful - * * @throws IOException If an IO error occurs */ - private boolean deleteResource(HttpServletRequest req, HttpServletResponse resp) throws IOException { + private void deleteResource(HttpServletRequest req, HttpServletResponse resp) throws IOException { String path = getRelativePath(req); - return deleteResource(path, req, resp, true); + deleteResource(path, req, resp, true); } @@ -1671,11 +1705,11 @@ private boolean deleteResource(String path, HttpServletRequest req, HttpServletR deleteCollection(req, path, errorList); if (!resource.delete()) { - errorList.put(path, Integer.valueOf(WebdavStatus.SC_INTERNAL_SERVER_ERROR)); + errorList.put(path, WebdavStatus.SC_INTERNAL_SERVER_ERROR); } if (!errorList.isEmpty()) { - sendReport(req, resp, errorList); + sendReport(resp, errorList); return false; } } @@ -1701,7 +1735,7 @@ private void deleteCollection(HttpServletRequest req, String path, Map errorList) + private void sendReport(HttpServletResponse resp, Map errorList) throws IOException { resp.setStatus(WebdavStatus.SC_MULTI_STATUS); @@ -1767,7 +1800,7 @@ private void sendReport(HttpServletRequest req, HttpServletResponse resp, Map errorEntry : errorList.entrySet()) { String errorPath = errorEntry.getKey(); - int errorCode = errorEntry.getValue().intValue(); + int errorCode = errorEntry.getValue(); generatedXML.writeElement("D", "response", XMLWriter.OPENING); @@ -1800,7 +1833,7 @@ private void sendReport(HttpServletRequest req, HttpServletResponse resp, Map properties) { + List properties) { // Exclude any resource in the /WEB-INF and /META-INF subdirectories if (isSpecialPath(path)) { @@ -1842,7 +1875,7 @@ private void parseProperties(HttpServletRequest req, XMLWriter generatedXML, Str * @param properties If the propfind type is find properties by name, then this List contains those properties */ private void parseLockNullProperties(HttpServletRequest req, XMLWriter generatedXML, String path, int type, - List properties) { + List properties) { // Exclude any resource in the /WEB-INF and /META-INF subdirectories if (isSpecialPath(path)) { @@ -1871,8 +1904,8 @@ private void parseLockNullProperties(HttpServletRequest req, XMLWriter generated private void generatePropFindResponse(XMLWriter generatedXML, String rewrittenUrl, String path, int propFindType, - List properties, boolean isFile, boolean isLockNull, long created, long lastModified, - long contentLength, String contentType, String eTag) { + List properties, boolean isFile, boolean isLockNull, long created, long lastModified, + long contentLength, String contentType, String eTag) { generatedXML.writeElement("D", "response", XMLWriter.OPENING); String status = "HTTP/1.1 " + WebdavStatus.SC_OK + " "; @@ -2176,6 +2209,7 @@ protected String determineMethodsAllowed(HttpServletRequest req) { */ private static class LockInfo implements Serializable { + @Serial private static final long serialVersionUID = 1L; LockInfo(int maxDepth) { @@ -2294,7 +2328,7 @@ public void toXML(XMLWriter generatedXML) { * references are filtered out for security reasons. See CVE-2007-5461. */ private static class WebdavResolver implements EntityResolver { - private ServletContext context; + private final ServletContext context; WebdavResolver(ServletContext theContext) { context = theContext; From d1f7c73c5057ba1d2e55fd10b5b80d92774ef551 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 17:25:19 +0800 Subject: [PATCH 06/27] chore: update release --- .github/release-drafter.yml | 21 +++++++ .github/workflows/release-drafter.yml | 20 +++++++ .github/workflows/release.yml | 79 --------------------------- 3 files changed, 41 insertions(+), 79 deletions(-) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release-drafter.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..649f58c5 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,21 @@ +# .github/release-drafter.yml +name-template: 'v$NEXT_PATCH_VERSION 🌟' +tag-template: 'v$NEXT_PATCH_VERSION' +categories: + - title: '新功能 ✨' + labels: + - 'feat' + - title: '修复 🐛' + labels: + - 'fix' + - title: '优化 🎨' + labels: + - 'perf' +change-template: '- $TITLE (#$NUMBER) @${{PRAUTHOR}}' +no-changes-template: '- No changes' +replacers: + - search: '(.*)' + replace: 'Updated: $1' +template: | + ## Changes + $CHANGES diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 00000000..ab2860a6 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,20 @@ +# .github/workflows/release-drafter.yml +name: Release Drafter + +on: + push: + branches: + - release + pull_request: + types: [closed] + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: release-drafter/release-drafter@v5 + with: + config-name: release-drafter.yml + env: + GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index fbb588ad..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: Create Release with Jar - -on: - push: - branches: - - release - -jobs: - build-and-release: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up JDK 17 - uses: actions/setup-java@v2 - with: - distribution: 'temurin' - java-version: '17' - - - name: Build with Maven - run: mvn clean package -DskipTests - - - name: Extract project version from pom.xml - run: | - VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) - echo "PROJECT_VERSION=$VERSION" >> $GITHUB_ENV - - - name: Generate Release Notes - id: generate_release_notes - run: | - git fetch --prune --unshallow - LATEST_TAG=$(git describe --tags --abbrev=0) - FEAT_MSGS=$(git log $LATEST_TAG..HEAD --grep 'feat:' --pretty=format:"- %s%n" | sed 's/feat://') - FIX_MSGS=$(git log $LATEST_TAG..HEAD --grep 'fix:' --pretty=format:"- %s%n" | sed 's/fix://') - PERF_MSGS=$(git log $LATEST_TAG..HEAD --grep 'perf:' --pretty=format:"- %s%n" | sed 's/perf://') - RELEASE_NOTES="" - if [ -n "$FEAT_MSGS" ]; then - RELEASE_NOTES+="### 新功能 ✨\n${FEAT_MSGS}\n" - fi - if [ -n "$FIX_MSGS" ]; then - RELEASE_NOTES+="### 修复 🐛\n${FIX_MSGS}\n" - fi - if [ -n "$PERF_MSGS" ]; then - RELEASE_NOTES+="### 优化 🎨\n${PERF_MSGS}\n" - fi - echo -e "RELEASE_NOTES<> $GITHUB_ENV - - - name: Create Git tag - run: | - git config user.name "GitHub Actions" - git config user.email "github-actions@users.noreply.github.com" - git tag -a v${{ env.PROJECT_VERSION }} -m "v${{ env.PROJECT_VERSION }}" - git push origin v${{ env.PROJECT_VERSION }} - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} - with: - tag_name: v${{ env.PROJECT_VERSION }} - release_name: v${{ env.PROJECT_VERSION }} - body: | - ## Changes in this release: - ${{ env.RELEASE_NOTES }} - draft: false - prerelease: false - - - name: Upload Jar to Release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./target/clouddisk-${{ env.PROJECT_VERSION }}.jar - asset_name: clouddisk-${{ env.PROJECT_VERSION }}.jar - asset_content_type: application/java-archive From 6f6eebe87b15f8180f0ddd679f78c0fe18529fa9 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 17:46:56 +0800 Subject: [PATCH 07/27] chore: update release --- .github/release-drafter.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 649f58c5..b4cb4f3c 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -4,18 +4,17 @@ tag-template: 'v$NEXT_PATCH_VERSION' categories: - title: '新功能 ✨' labels: - - 'feat' + - 'feature' - title: '修复 🐛' labels: - - 'fix' - - title: '优化 🎨' + - 'bug' + - title: '优化 ⚡️' labels: - - 'perf' -change-template: '- $TITLE (#$NUMBER) @${{PRAUTHOR}}' + - 'improvement' +change-template: '- $TITLE (#$NUMBER)' no-changes-template: '- No changes' -replacers: - - search: '(.*)' - replace: 'Updated: $1' template: | + ## v$NEXT_PATCH_VERSION 🌟 + ## Changes $CHANGES From 91f35654f6c3317b333acdb3cc4957dd864b5a8e Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 17:59:09 +0800 Subject: [PATCH 08/27] chore: update release --- .github/release-drafter.yml | 10 ++++++++-- .github/workflows/nightly-build.yml | 3 ++- .github/workflows/nightly-nvidia-build.yml | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index b4cb4f3c..e65e29df 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -14,7 +14,13 @@ categories: change-template: '- $TITLE (#$NUMBER)' no-changes-template: '- No changes' template: | - ## v$NEXT_PATCH_VERSION 🌟 + ## Changes in this release: - ## Changes + ## 新功能 ✨ + $CHANGES + + ## 修复 🐛 + $CHANGES + + ## 优化 ⚡️ $CHANGES diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 310c0878..da5a53c1 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -3,7 +3,8 @@ name: Build nightly on: push: branches: - - '*' + - 'develop' + - 'master' workflow_dispatch: jobs: diff --git a/.github/workflows/nightly-nvidia-build.yml b/.github/workflows/nightly-nvidia-build.yml index a9bbc1a7..575785bf 100644 --- a/.github/workflows/nightly-nvidia-build.yml +++ b/.github/workflows/nightly-nvidia-build.yml @@ -3,7 +3,8 @@ name: Build nightly (nvidia) on: push: branches: - - '*' + - 'develop' + - 'master' workflow_dispatch: jobs: From 52c55567c99bd861ba8a6a96f2d24b866436f0a7 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 18:05:58 +0800 Subject: [PATCH 09/27] chore: update release --- .github/release-drafter.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index e65e29df..48ee6101 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -16,11 +16,17 @@ no-changes-template: '- No changes' template: | ## Changes in this release: + {% if categories['新功能 ✨'] %} ## 新功能 ✨ - $CHANGES + {{categories['新功能 ✨']}} + {% endif %} + {% if categories['修复 🐛'] %} ## 修复 🐛 - $CHANGES + {{categories['修复 🐛']}} + {% endif %} + {% if categories['优化 ⚡️'] %} ## 优化 ⚡️ - $CHANGES + {{categories['优化 ⚡️']}} + {% endif %} From 8489083bab1952ec00d9c82bb68410d276f9e4e4 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 18:08:45 +0800 Subject: [PATCH 10/27] chore: update release --- .github/release-drafter.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 48ee6101..98ad5080 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,4 +1,3 @@ -# .github/release-drafter.yml name-template: 'v$NEXT_PATCH_VERSION 🌟' tag-template: 'v$NEXT_PATCH_VERSION' categories: @@ -10,11 +9,11 @@ categories: - 'bug' - title: '优化 ⚡️' labels: - - 'improvement' -change-template: '- $TITLE (#$NUMBER)' -no-changes-template: '- No changes' + - 'perf' # 确保标签名称一致 +change-template: '- $TITLE (#$NUMBER) @${{PRAUTHOR}}' +no-changes-template: '- 没有变化' template: | - ## Changes in this release: + ## v$NEXT_PATCH_VERSION 🌟 {% if categories['新功能 ✨'] %} ## 新功能 ✨ From f62fcdfb948eaf4e15d5ec55a53dc68d36da9497 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 18:14:01 +0800 Subject: [PATCH 11/27] chore: update release --- .github/release-drafter.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 98ad5080..7e4fdbab 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,3 +1,4 @@ +# .github/release-drafter.yml name-template: 'v$NEXT_PATCH_VERSION 🌟' tag-template: 'v$NEXT_PATCH_VERSION' categories: @@ -9,23 +10,23 @@ categories: - 'bug' - title: '优化 ⚡️' labels: - - 'perf' # 确保标签名称一致 -change-template: '- $TITLE (#$NUMBER) @${{PRAUTHOR}}' -no-changes-template: '- 没有变化' + - 'improvement' +change-template: '- $TITLE (#$NUMBER)' +no-changes-template: '- No changes' template: | - ## v$NEXT_PATCH_VERSION 🌟 + ## Changes in this release: {% if categories['新功能 ✨'] %} ## 新功能 ✨ - {{categories['新功能 ✨']}} + {{ categories['新功能 ✨'] | replace('\n', '\n- ') }} {% endif %} {% if categories['修复 🐛'] %} ## 修复 🐛 - {{categories['修复 🐛']}} + {{ categories['修复 🐛'] | replace('\n', '\n- ') }} {% endif %} {% if categories['优化 ⚡️'] %} ## 优化 ⚡️ - {{categories['优化 ⚡️']}} + {{ categories['优化 ⚡️'] | replace('\n', '\n- ') }} {% endif %} From cf5addb0c8e4d16cc78065038167da8e545982ae Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 18:17:27 +0800 Subject: [PATCH 12/27] chore: update release --- .github/release-drafter.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 7e4fdbab..6ca829bd 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -18,15 +18,15 @@ template: | {% if categories['新功能 ✨'] %} ## 新功能 ✨ - {{ categories['新功能 ✨'] | replace('\n', '\n- ') }} + {{ categories['新功能 ✨'] }} {% endif %} {% if categories['修复 🐛'] %} ## 修复 🐛 - {{ categories['修复 🐛'] | replace('\n', '\n- ') }} + {{ categories['修复 🐛'] }} {% endif %} {% if categories['优化 ⚡️'] %} ## 优化 ⚡️ - {{ categories['优化 ⚡️'] | replace('\n', '\n- ') }} + {{ categories['优化 ⚡️'] }} {% endif %} From cc87306cf0154c177c13571550939f05227d9360 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 18:20:09 +0800 Subject: [PATCH 13/27] chore: update release --- .github/workflows/nightly-build.yml | 1 - .github/workflows/nightly-nvidia-build.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index da5a53c1..0f5dc07d 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -4,7 +4,6 @@ on: push: branches: - 'develop' - - 'master' workflow_dispatch: jobs: diff --git a/.github/workflows/nightly-nvidia-build.yml b/.github/workflows/nightly-nvidia-build.yml index 575785bf..2974f85a 100644 --- a/.github/workflows/nightly-nvidia-build.yml +++ b/.github/workflows/nightly-nvidia-build.yml @@ -4,7 +4,6 @@ on: push: branches: - 'develop' - - 'master' workflow_dispatch: jobs: From b2eda87e88228d4cc9137a8a54e5b604111d5623 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 18:21:35 +0800 Subject: [PATCH 14/27] chore: update release --- .github/workflows/release-drafter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index ab2860a6..3cc01b4b 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -4,7 +4,7 @@ name: Release Drafter on: push: branches: - - release + - master pull_request: types: [closed] From 87798e7cb801ec4a8ed150980d1bbad1db3cbde2 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 18:23:26 +0800 Subject: [PATCH 15/27] chore: update release --- .github/release-drafter.yml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 6ca829bd..8208542b 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -16,17 +16,4 @@ no-changes-template: '- No changes' template: | ## Changes in this release: - {% if categories['新功能 ✨'] %} - ## 新功能 ✨ - {{ categories['新功能 ✨'] }} - {% endif %} - - {% if categories['修复 🐛'] %} - ## 修复 🐛 - {{ categories['修复 🐛'] }} - {% endif %} - - {% if categories['优化 ⚡️'] %} - ## 优化 ⚡️ - {{ categories['优化 ⚡️'] }} - {% endif %} + $CHANGES From 9d620480fa9d506c5880ebf436f66e674f5d4f20 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 18:25:04 +0800 Subject: [PATCH 16/27] chore: update release --- .github/release-drafter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 8208542b..73f42ca1 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -16,4 +16,4 @@ no-changes-template: '- No changes' template: | ## Changes in this release: - $CHANGES +# $CHANGES From 2bc8c550a2cf619e97d8fdf1e27202a4786d3844 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 18:26:18 +0800 Subject: [PATCH 17/27] chore: update release --- .github/release-drafter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 73f42ca1..8208542b 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -16,4 +16,4 @@ no-changes-template: '- No changes' template: | ## Changes in this release: -# $CHANGES + $CHANGES From 0586a0b3c5046b203eca949b099433ef49294367 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 18:37:03 +0800 Subject: [PATCH 18/27] chore: update release --- .github/release-drafter.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 8208542b..6db17e73 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -17,3 +17,6 @@ template: | ## Changes in this release: $CHANGES + + ## Full Changelog + [Full Changelog](https://github.com/OWNER/REPO/compare/v$PREVIOUS_TAG...v$NEXT_TAG) From ad765960b5f90bd9363f28fd4bcfe4520a606a0a Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 18:38:54 +0800 Subject: [PATCH 19/27] chore: update release --- .github/release-drafter.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 6db17e73..bfff7e18 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,5 +1,5 @@ # .github/release-drafter.yml -name-template: 'v$NEXT_PATCH_VERSION 🌟' +name-template: 'v$NEXT_PATCH_VERSION' tag-template: 'v$NEXT_PATCH_VERSION' categories: - title: '新功能 ✨' @@ -18,5 +18,4 @@ template: | $CHANGES - ## Full Changelog - [Full Changelog](https://github.com/OWNER/REPO/compare/v$PREVIOUS_TAG...v$NEXT_TAG) + Full Changelog: [v$PREVIOUS_TAG...v$NEXT_TAG](https://github.com/OWNER/REPO/compare/v$PREVIOUS_TAG...v$NEXT_TAG) From 07b3a3d77b146853909b569da033fb87bd038b56 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 18:40:32 +0800 Subject: [PATCH 20/27] chore: update release --- .github/release-drafter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index bfff7e18..32d0ba94 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -18,4 +18,4 @@ template: | $CHANGES - Full Changelog: [v$PREVIOUS_TAG...v$NEXT_TAG](https://github.com/OWNER/REPO/compare/v$PREVIOUS_TAG...v$NEXT_TAG) + Full Changelog: [$PREVIOUS_TAG...v$NEXT_PATCH_VERSION](https://github.com/OWNER/REPO/compare/$PREVIOUS_TAG...v$NEXT_PATCH_VERSION) From e14b1610b248698fe9c1444e46500ff6f06d2c12 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 18:43:25 +0800 Subject: [PATCH 21/27] chore: update release --- .github/release-drafter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 32d0ba94..c7fa2b46 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -18,4 +18,4 @@ template: | $CHANGES - Full Changelog: [$PREVIOUS_TAG...v$NEXT_PATCH_VERSION](https://github.com/OWNER/REPO/compare/$PREVIOUS_TAG...v$NEXT_PATCH_VERSION) + **Full Changelog**: [$PREVIOUS_TAG...v$NEXT_PATCH_VERSION](https://github.com/jamebal/jmal-cloud-server/compare/$PREVIOUS_TAG...v$NEXT_PATCH_VERSION) From f6b159b4422a30b15cbe8ea005820604dfa5995f Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 18:46:40 +0800 Subject: [PATCH 22/27] chore: update release --- .github/workflows/nightly-build.yml | 1 + .github/workflows/nightly-nvidia-build.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 0f5dc07d..da5a53c1 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -4,6 +4,7 @@ on: push: branches: - 'develop' + - 'master' workflow_dispatch: jobs: diff --git a/.github/workflows/nightly-nvidia-build.yml b/.github/workflows/nightly-nvidia-build.yml index 2974f85a..575785bf 100644 --- a/.github/workflows/nightly-nvidia-build.yml +++ b/.github/workflows/nightly-nvidia-build.yml @@ -4,6 +4,7 @@ on: push: branches: - 'develop' + - 'master' workflow_dispatch: jobs: From c28b9c1026e07da226b7645f379df9c6a1c5f2f8 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 18:49:31 +0800 Subject: [PATCH 23/27] bump version to v2.8.3 --- pom.xml | 2 +- src/main/resources/application.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index e98229a6..cb969374 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ com.jmal clouddisk - 2.8.2 + 2.8.3 clouddisk Cloud Disk jar diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 8b32ef44..3868f633 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -6,7 +6,7 @@ server: charset: UTF-8 enabled: true forward-headers-strategy: native -version: 2.8.2 +version: 2.8.3 spring: application: name: jmalcloud From ca96d0da4e3e89162c16240e8aff05bdc4ac53e2 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 18:58:12 +0800 Subject: [PATCH 24/27] chore: update release --- .github/release-drafter.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index c7fa2b46..f5883df0 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -14,6 +14,12 @@ categories: change-template: '- $TITLE (#$NUMBER)' no-changes-template: '- No changes' template: | + + ### 更新前备份数据库 + ```shell + docker exec -it jmalcloud_mongodb mongodump -d jmalcloud -o /dump --gzip --quiet + ``` + ## Changes in this release: $CHANGES From 0cbe58f77c8a3c753a2660abe3e426f7f6a27cf2 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 19:06:57 +0800 Subject: [PATCH 25/27] chore: update release --- .github/release-drafter.yml | 11 +++++++++-- .github/workflows/nightly-build.yml | 1 - .github/workflows/nightly-nvidia-build.yml | 1 - docker-compose.example2.yml | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index f5883df0..b381d96c 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -15,9 +15,16 @@ change-template: '- $TITLE (#$NUMBER)' no-changes-template: '- No changes' template: | - ### 更新前备份数据库 + [docker-docker.yml](https://github.com/jamebal/jmal-cloud-server/blob/master/docker-compose.example2.yml) + + #### 更新前备份数据库 + + ```shell + docker exec -it jmalcloud_mongodb mongodump -d jmalcloud -o /dump/$PREVIOUS_TAG --gzip --quiet + ``` + ```shell - docker exec -it jmalcloud_mongodb mongodump -d jmalcloud -o /dump --gzip --quiet + docker-compose pull && docker-compose up -d ``` ## Changes in this release: diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index da5a53c1..511411ca 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -3,7 +3,6 @@ name: Build nightly on: push: branches: - - 'develop' - 'master' workflow_dispatch: diff --git a/.github/workflows/nightly-nvidia-build.yml b/.github/workflows/nightly-nvidia-build.yml index 575785bf..601bcc86 100644 --- a/.github/workflows/nightly-nvidia-build.yml +++ b/.github/workflows/nightly-nvidia-build.yml @@ -3,7 +3,6 @@ name: Build nightly (nvidia) on: push: branches: - - 'develop' - 'master' workflow_dispatch: diff --git a/docker-compose.example2.yml b/docker-compose.example2.yml index c1c02c45..5ce5c6ba 100644 --- a/docker-compose.example2.yml +++ b/docker-compose.example2.yml @@ -18,6 +18,7 @@ services: TZ: Asia/Shanghai volumes: - ./docker/jmalcloud/mongodb/data/db:/data/db + - ./docker/jmalcloud/mongodb/backup:/dump restart: unless-stopped command: --wiredTigerCacheSizeGB 0.5 nginx: From 7645639c9e0d2fdd113669e1039d85c99adaeb1c Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 19:18:07 +0800 Subject: [PATCH 26/27] chore: update release --- .github/workflows/release-drafter.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 3cc01b4b..f02e72e8 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -5,8 +5,6 @@ on: push: branches: - master - pull_request: - types: [closed] jobs: update_release_draft: From f54b12fbbe60d1d974daf9975fc38ee4430261de Mon Sep 17 00:00:00 2001 From: jmal Date: Sat, 18 May 2024 18:51:16 +0800 Subject: [PATCH 27/27] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=8E=8B=E7=BC=A9=E5=8C=85=E6=9C=89=E5=87=A0=E7=8E=87?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98=20https://github.?= =?UTF-8?q?com/jamebal/jmal-cloud-view/issues/102?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CommonFileService.java | 54 ++++++++++--------- .../com/jmal/clouddisk/util/CaffeineUtil.java | 16 +++--- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/src/main/java/com/jmal/clouddisk/service/impl/CommonFileService.java b/src/main/java/com/jmal/clouddisk/service/impl/CommonFileService.java index 005dab5b..06f0c8ee 100644 --- a/src/main/java/com/jmal/clouddisk/service/impl/CommonFileService.java +++ b/src/main/java/com/jmal/clouddisk/service/impl/CommonFileService.java @@ -109,10 +109,10 @@ public class CommonFileService { @Autowired public LuceneService luceneService; - /*** + /** * 上传文件夹的写入锁缓存 */ - private final Cache uploadFolderLockCache = CaffeineUtil.getUploadFolderLockCache(); + private final Cache uploadFileLockCache = CaffeineUtil.getUploadFileLockCache(); protected static final Set FILE_PATH_LOCK = new CopyOnWriteArraySet<>(); @@ -304,12 +304,9 @@ public String createFile(String username, File file, String userId, Boolean isPu } String fileAbsolutePath = file.getAbsolutePath(); - Lock lock = null; - if (file.isDirectory()) { - lock = uploadFolderLockCache.get(fileAbsolutePath, key -> new ReentrantLock()); - if (lock != null) { - lock.lock(); - } + Lock lock = uploadFileLockCache.get(fileAbsolutePath, key -> new ReentrantLock()); + if (lock != null) { + lock.lock(); } UpdateResult updateResult; ObjectId objectId = new ObjectId(); @@ -356,6 +353,7 @@ public String createFile(String username, File file, String userId, Boolean isPu } finally { if (lock != null) { lock.unlock(); + uploadFileLockCache.invalidate(fileAbsolutePath); } } if (null != updateResult.getUpsertedId()) { @@ -446,24 +444,28 @@ public void imageFileToWebp(File outputFile, BufferedImage image) throws IOExcep } private void setFileConfig(String fileId, String username, File file, String fileName, String suffix, String contentType, String relativePath, Update update) { - long size = file.length(); - update.set("size", size); - update.set("md5", size + relativePath + fileName); - update.set(Constants.CONTENT_TYPE, getContentType(file, contentType)); - update.set(Constants.SUFFIX, suffix); - if (contentType.contains(Constants.AUDIO)) { - setMusic(file, update); - } - if (contentType.contains(Constants.VIDEO)) { - setMediaCover(fileId, username, fileName, relativePath, update); - } - if (contentType.startsWith(Constants.CONTENT_TYPE_IMAGE) && (!"ico".equals(suffix) && !"svg".equals(suffix))) { - generateThumbnail(file, update); - } - if (contentType.contains(Constants.CONTENT_TYPE_MARK_DOWN) || "md".equals(suffix)) { - // 写入markdown内容 - String markDownContent = FileUtil.readString(file, MyFileUtils.getFileCharset(file)); - update.set("contentText", markDownContent); + try { + long size = file.length(); + update.set("size", size); + update.set("md5", size + relativePath + fileName); + update.set(Constants.CONTENT_TYPE, getContentType(file, contentType)); + update.set(Constants.SUFFIX, suffix); + if (contentType.contains(Constants.AUDIO)) { + setMusic(file, update); + } + if (contentType.contains(Constants.VIDEO)) { + setMediaCover(fileId, username, fileName, relativePath, update); + } + if (contentType.startsWith(Constants.CONTENT_TYPE_IMAGE) && (!"ico".equals(suffix) && !"svg".equals(suffix))) { + generateThumbnail(file, update); + } + if (contentType.contains(Constants.CONTENT_TYPE_MARK_DOWN) || "md".equals(suffix)) { + // 写入markdown内容 + String markDownContent = FileUtil.readString(file, MyFileUtils.getFileCharset(file)); + update.set("contentText", markDownContent); + } + } catch (Exception e) { + log.error(e.getMessage(), e); } } diff --git a/src/main/java/com/jmal/clouddisk/util/CaffeineUtil.java b/src/main/java/com/jmal/clouddisk/util/CaffeineUtil.java index a1ff0d82..266e2da7 100644 --- a/src/main/java/com/jmal/clouddisk/util/CaffeineUtil.java +++ b/src/main/java/com/jmal/clouddisk/util/CaffeineUtil.java @@ -70,10 +70,10 @@ public class CaffeineUtil { */ private static Cache chunkWriteLockCache; - /*** - * 上传文件夹锁 + /** + * 上传文件锁 */ - private static Cache uploadFolderLockCache; + private static Cache uploadFileLockCache; /*** * 用户身份权限缓存 @@ -147,8 +147,8 @@ public static void initMyCache(){ if(chunkWriteLockCache == null){ chunkWriteLockCache = Caffeine.newBuilder().build(); } - if(uploadFolderLockCache == null) { - uploadFolderLockCache = Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).build(); + if(uploadFileLockCache == null) { + uploadFileLockCache = Caffeine.newBuilder().build(); } } @@ -180,11 +180,11 @@ public static Cache getChunkWriteLockCache(){ return chunkWriteLockCache; } - public static Cache getUploadFolderLockCache(){ - if(uploadFolderLockCache == null){ + public static Cache getUploadFileLockCache(){ + if(uploadFileLockCache == null){ initMyCache(); } - return uploadFolderLockCache; + return uploadFileLockCache; } public static void setSpaceFull(String userId) {