From 2890768b514accdad27453eb04b569ec0499a585 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Fri, 8 Mar 2024 18:36:34 +0000 Subject: [PATCH 01/13] fix: upgrade @types/node from 20.11.18 to 20.11.19 Snyk has created this PR to upgrade @types/node from 20.11.18 to 20.11.19. See this package in npm: https://www.npmjs.com/package/@types/node See this project in Snyk: https://app.snyk.io/org/qdraw/project/3eed192c-1a65-4594-8052-8d49e13d7314?utm_source=github&utm_medium=referral&page=upgrade-pr --- starsky-tools/thumbnail/package-lock.json | 14 +++++++------- starsky-tools/thumbnail/package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/starsky-tools/thumbnail/package-lock.json b/starsky-tools/thumbnail/package-lock.json index a157294b25..5a1330e0bb 100644 --- a/starsky-tools/thumbnail/package-lock.json +++ b/starsky-tools/thumbnail/package-lock.json @@ -18,7 +18,7 @@ "p-iteration": "^1.1.8" }, "devDependencies": { - "@types/node": "^20.11.18", + "@types/node": "^20.11.19", "concurrently": "^8.2.2", "typescript": "^5.3.3" } @@ -437,9 +437,9 @@ } }, "node_modules/@types/node": { - "version": "20.11.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.18.tgz", - "integrity": "sha512-ABT5VWnnYneSBcNWYSCuR05M826RoMyMSGiFivXGx6ZUIsXb9vn4643IEwkg2zbEOSgAiSogtapN2fgc4mAPlw==", + "version": "20.11.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", + "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", "dependencies": { "undici-types": "~5.26.4" } @@ -1826,9 +1826,9 @@ } }, "@types/node": { - "version": "20.11.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.18.tgz", - "integrity": "sha512-ABT5VWnnYneSBcNWYSCuR05M826RoMyMSGiFivXGx6ZUIsXb9vn4643IEwkg2zbEOSgAiSogtapN2fgc4mAPlw==", + "version": "20.11.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", + "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", "requires": { "undici-types": "~5.26.4" } diff --git a/starsky-tools/thumbnail/package.json b/starsky-tools/thumbnail/package.json index dad34445c9..dd71b65cdf 100644 --- a/starsky-tools/thumbnail/package.json +++ b/starsky-tools/thumbnail/package.json @@ -27,7 +27,7 @@ "p-iteration": "^1.1.8" }, "devDependencies": { - "@types/node": "^20.11.18", + "@types/node": "^20.11.19", "concurrently": "^8.2.2", "typescript": "^5.3.3" } From 6ec6dbe3ef626eac04045b598f55e237e07712e0 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Fri, 8 Mar 2024 18:38:36 +0000 Subject: [PATCH 02/13] fix: upgrade eslint-plugin-jest from 27.8.0 to 27.9.0 Snyk has created this PR to upgrade eslint-plugin-jest from 27.8.0 to 27.9.0. See this package in npm: https://www.npmjs.com/package/eslint-plugin-jest See this project in Snyk: https://app.snyk.io/org/qdraw/project/8efd618d-a300-4d64-93b4-6c13314df270?utm_source=github&utm_medium=referral&page=upgrade-pr --- starskydesktop/package-lock.json | 14 +++++++------- starskydesktop/package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/starskydesktop/package-lock.json b/starskydesktop/package-lock.json index 5cd5ca1bff..e68c974edc 100644 --- a/starskydesktop/package-lock.json +++ b/starskydesktop/package-lock.json @@ -29,7 +29,7 @@ "eslint-config-airbnb-typescript": "^17.1.0", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jest": "^27.8.0", + "eslint-plugin-jest": "^27.9.0", "eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", @@ -5882,9 +5882,9 @@ } }, "node_modules/eslint-plugin-jest": { - "version": "27.8.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.8.0.tgz", - "integrity": "sha512-347hVFiu4ZKMYl5xFp0X81gLNwBdno0dl0CMpUMjwuAux9X/M2a7z+ab2VHmPL6XCT87q8nv1vaVzhIO4TE/hw==", + "version": "27.9.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.9.0.tgz", + "integrity": "sha512-QIT7FH7fNmd9n4se7FFKHbsLKGQiw885Ds6Y/sxKgCZ6natwCsXdgPOADnYVxN2QrRweF0FZWbJ6S7Rsn7llug==", "dev": true, "dependencies": { "@typescript-eslint/utils": "^5.10.0" @@ -16750,9 +16750,9 @@ } }, "eslint-plugin-jest": { - "version": "27.8.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.8.0.tgz", - "integrity": "sha512-347hVFiu4ZKMYl5xFp0X81gLNwBdno0dl0CMpUMjwuAux9X/M2a7z+ab2VHmPL6XCT87q8nv1vaVzhIO4TE/hw==", + "version": "27.9.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.9.0.tgz", + "integrity": "sha512-QIT7FH7fNmd9n4se7FFKHbsLKGQiw885Ds6Y/sxKgCZ6natwCsXdgPOADnYVxN2QrRweF0FZWbJ6S7Rsn7llug==", "dev": true, "requires": { "@typescript-eslint/utils": "^5.10.0" diff --git a/starskydesktop/package.json b/starskydesktop/package.json index 1d0b2b4b8c..f1e035566c 100644 --- a/starskydesktop/package.json +++ b/starskydesktop/package.json @@ -103,7 +103,7 @@ "eslint-config-airbnb-typescript": "^17.1.0", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jest": "^27.8.0", + "eslint-plugin-jest": "^27.9.0", "eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", From e538075cb5e2509ab5235b0cce7c1a388fa25d89 Mon Sep 17 00:00:00 2001 From: Dion Date: Fri, 8 Mar 2024 19:53:43 +0100 Subject: [PATCH 03/13] Remove unused cultures dll's --- starsky/starsky/starsky.csproj | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/starsky/starsky/starsky.csproj b/starsky/starsky/starsky.csproj index a8a33126b0..7767ca97b6 100644 --- a/starsky/starsky/starsky.csproj +++ b/starsky/starsky/starsky.csproj @@ -217,4 +217,25 @@ true + + + + + + + + false + + + + + + + + + + + + + From e48cc208b2fafbeddcc14dfe08294cfd1f05f7d7 Mon Sep 17 00:00:00 2001 From: Dion van Velde Date: Fri, 8 Mar 2024 21:30:02 +0100 Subject: [PATCH 04/13] keep a changelog --- history.md | 1 + 1 file changed, 1 insertion(+) diff --git a/history.md b/history.md index 7f54f4f877..2f1634fe11 100644 --- a/history.md +++ b/history.md @@ -54,6 +54,7 @@ Semantic Versioning 2.0.0 is from version 0.1.6+ - [x] (Fixed) _Back-end_ Longer regex timeout for GetFileName (PR #1444) - [x] (Fixed) _Back-end_ Warnings for Sonarcloud (PR #1445) - [x] (Fixed) _Front-end_ Fix list item status OkAndSame is not red anymore (PR #1445) +- [x] (Removed) _Back-end_ Unused .NET cultures (PR #1453) ## version 0.6.0-beta.2 - 2024-03-05 {#v0.6.0-beta.2} From 3eab39fb0a5e64c01c98542a1cb55eeacbf0fac8 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Mon, 11 Mar 2024 01:16:54 +0000 Subject: [PATCH 05/13] fix: upgrade @types/react from 18.2.55 to 18.2.56 Snyk has created this PR to upgrade @types/react from 18.2.55 to 18.2.56. See this package in npm: https://www.npmjs.com/package/@types/react See this project in Snyk: https://app.snyk.io/org/qdraw/project/8efd618d-a300-4d64-93b4-6c13314df270?utm_source=github&utm_medium=referral&page=upgrade-pr --- starskydesktop/package-lock.json | 14 +++++++------- starskydesktop/package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/starskydesktop/package-lock.json b/starskydesktop/package-lock.json index e68c974edc..3e8aaffa10 100644 --- a/starskydesktop/package-lock.json +++ b/starskydesktop/package-lock.json @@ -17,7 +17,7 @@ }, "devDependencies": { "@types/jest": "^29.5.11", - "@types/react": "^18.2.55", + "@types/react": "^18.2.56", "@types/react-dom": "^18.2.19", "@types/wait-on": "^5.3.4", "@typescript-eslint/eslint-plugin": "^6.19.1", @@ -2079,9 +2079,9 @@ "dev": true }, "node_modules/@types/react": { - "version": "18.2.55", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.55.tgz", - "integrity": "sha512-Y2Tz5P4yz23brwm2d7jNon39qoAtMMmalOQv6+fEFt1mT+FcM3D841wDpoUvFXhaYenuROCy3FZYqdTjM7qVyA==", + "version": "18.2.56", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.56.tgz", + "integrity": "sha512-NpwHDMkS/EFZF2dONFQHgkPRwhvgq/OAvIaGQzxGSBmaeR++kTg6njr15Vatz0/2VcCEwJQFi6Jf4Q0qBu0rLA==", "dev": true, "dependencies": { "@types/prop-types": "*", @@ -13868,9 +13868,9 @@ "dev": true }, "@types/react": { - "version": "18.2.55", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.55.tgz", - "integrity": "sha512-Y2Tz5P4yz23brwm2d7jNon39qoAtMMmalOQv6+fEFt1mT+FcM3D841wDpoUvFXhaYenuROCy3FZYqdTjM7qVyA==", + "version": "18.2.56", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.56.tgz", + "integrity": "sha512-NpwHDMkS/EFZF2dONFQHgkPRwhvgq/OAvIaGQzxGSBmaeR++kTg6njr15Vatz0/2VcCEwJQFi6Jf4Q0qBu0rLA==", "dev": true, "requires": { "@types/prop-types": "*", diff --git a/starskydesktop/package.json b/starskydesktop/package.json index f1e035566c..fa855cccd1 100644 --- a/starskydesktop/package.json +++ b/starskydesktop/package.json @@ -91,7 +91,7 @@ }, "devDependencies": { "@types/jest": "^29.5.11", - "@types/react": "^18.2.55", + "@types/react": "^18.2.56", "@types/react-dom": "^18.2.19", "@types/wait-on": "^5.3.4", "@typescript-eslint/eslint-plugin": "^6.19.1", From 0bea31188348a5f228a8e3df45f3a0cdf042eb4b Mon Sep 17 00:00:00 2001 From: Dion Date: Mon, 11 Mar 2024 10:56:42 +0100 Subject: [PATCH 06/13] [WindowsTest] If IO Exception skip --- .../Helpers/WindowsOpenDesktopAppTests.cs | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/starsky/starskytest/starsky.foundation.native/OpenApplicationNative/Helpers/WindowsOpenDesktopAppTests.cs b/starsky/starskytest/starsky.foundation.native/OpenApplicationNative/Helpers/WindowsOpenDesktopAppTests.cs index aa14f75785..be990e424d 100644 --- a/starsky/starskytest/starsky.foundation.native/OpenApplicationNative/Helpers/WindowsOpenDesktopAppTests.cs +++ b/starsky/starskytest/starsky.foundation.native/OpenApplicationNative/Helpers/WindowsOpenDesktopAppTests.cs @@ -6,6 +6,7 @@ using starskytest.FakeCreateAn.CreateFakeStarskyExe; using System.Collections.Generic; using System.ComponentModel; +using System.IO; using System.Runtime.InteropServices; using System.Threading.Tasks; using Medallion.Shell; @@ -16,7 +17,7 @@ namespace starskytest.starsky.foundation.native.OpenApplicationNative.Helpers; public class WindowsOpenDesktopAppTests { private const string Extension = ".starsky"; - private const string ProgId = "starskytest"; + private const string ProgramId = "starskytest"; private const string FileTypeDescription = "Starsky Test File"; [TestInitialize] @@ -41,8 +42,15 @@ private static void CleanSetup() } // Ensure no keys exist before the test starts - Registry.CurrentUser.DeleteSubKeyTree($"Software\\Classes\\{Extension}", false); - Registry.CurrentUser.DeleteSubKeyTree($"Software\\Classes\\{ProgId}", false); + try + { + Registry.CurrentUser.DeleteSubKeyTree($@"Software\Classes\{Extension}", false); + Registry.CurrentUser.DeleteSubKeyTree($@"Software\Classes\{ProgramId}", false); + } + catch ( IOException ) + { + // do nothing + } } private static CreateFakeStarskyWindowsExe SetupEnsureAssociationsSet() @@ -58,7 +66,7 @@ private static CreateFakeStarskyWindowsExe SetupEnsureAssociationsSet() new FileAssociation { Extension = Extension, - ProgId = ProgId, + ProgId = ProgramId, FileTypeDescription = FileTypeDescription, ExecutableFilePath = filePath }); @@ -72,7 +80,7 @@ public void W_OpenDefault_NonWindows() var result = WindowsOpenDesktopApp.OpenDefault(["any value"], OSPlatform.Linux); Assert.IsNull(result); } - + [TestMethod] public void W_OpenDefault2_NonWindows() { @@ -117,7 +125,7 @@ public async Task W_OpenDefault_HappyFlow__WindowsOnly() WindowsOpenDesktopApp.OpenDefault([mock.StarskyDotStarskyPath], OSPlatform.Windows); // Retry if failed due to multi-threading - for (var i = 0; i < 2 && result != true; i++) + for ( var i = 0; i < 2 && result != true; i++ ) { Console.WriteLine($"Retry due to multi-threading {i + 1}"); await Task.Delay(1000); @@ -135,7 +143,7 @@ public void W_OpenApplicationAtUrl_NonWindows() "app", OSPlatform.Linux); Assert.IsNull(result); } - + [TestMethod] [ExpectedException(typeof(Win32Exception))] public void W_OpenApplicationAtUrl2_NonWindows() @@ -147,7 +155,7 @@ public void W_OpenApplicationAtUrl2_NonWindows() } // ExpectedException = Win32Exception - WindowsOpenDesktopApp.OpenApplicationAtUrl(["any value"], + WindowsOpenDesktopApp.OpenApplicationAtUrl(["any value"], "/not_found_849539453", OSPlatform.Windows); } From 8e26cfe9bbf35bc2aa8db50ed650c6c656e3ab48 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 09:57:09 +0000 Subject: [PATCH 07/13] Bump nwtgck/actions-netlify from 2.1 to 3.0 Bumps [nwtgck/actions-netlify](https://github.com/nwtgck/actions-netlify) from 2.1 to 3.0. - [Release notes](https://github.com/nwtgck/actions-netlify/releases) - [Changelog](https://github.com/nwtgck/actions-netlify/blob/develop/CHANGELOG.md) - [Commits](https://github.com/nwtgck/actions-netlify/compare/v2.1...v3.0) --- updated-dependencies: - dependency-name: nwtgck/actions-netlify dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/storybook-clientapp-netlify.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/storybook-clientapp-netlify.yml b/.github/workflows/storybook-clientapp-netlify.yml index 5bd0e0a5c3..2e2c30669d 100644 --- a/.github/workflows/storybook-clientapp-netlify.yml +++ b/.github/workflows/storybook-clientapp-netlify.yml @@ -45,7 +45,7 @@ jobs: path: ./starsky/starsky/clientapp/storybook-static - name: Deploy to Netlify - uses: nwtgck/actions-netlify@v2.1 + uses: nwtgck/actions-netlify@v3.0 if: github.event_name != 'pull_request' with: publish-dir: './starsky/starsky/clientapp/storybook-static' From ac7e6419f1d2bff046c87efe92571839b6368ab0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 09:57:13 +0000 Subject: [PATCH 08/13] Bump softprops/action-gh-release from 1 to 2 Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/release-on-tag-netcore-desktop-electron.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-on-tag-netcore-desktop-electron.yml b/.github/workflows/release-on-tag-netcore-desktop-electron.yml index 8ec6d5f257..d6601d374a 100644 --- a/.github/workflows/release-on-tag-netcore-desktop-electron.yml +++ b/.github/workflows/release-on-tag-netcore-desktop-electron.yml @@ -238,7 +238,7 @@ jobs: - name: Create Release id: create_release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/v') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 696b7eb5e1bb5652dc3b85ba7860ce17bdc9aff3 Mon Sep 17 00:00:00 2001 From: Dion Date: Mon, 11 Mar 2024 11:40:41 +0100 Subject: [PATCH 09/13] [Regex] Failed to execute PeriodicThumbnailScanHostedService with exception message One or more errors occurred. (The Regex engine has timed out while trying to match a pattern to an input string. ... --- .../Helpers/FilenamesHelper.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/starsky/starsky.foundation.platform/Helpers/FilenamesHelper.cs b/starsky/starsky.foundation.platform/Helpers/FilenamesHelper.cs index 213309bdfc..1dcc4cbb8b 100644 --- a/starsky/starsky.foundation.platform/Helpers/FilenamesHelper.cs +++ b/starsky/starsky.foundation.platform/Helpers/FilenamesHelper.cs @@ -15,7 +15,7 @@ public static partial class FilenamesHelper /// Regex object [GeneratedRegex( "^[a-zA-Z0-9_](?:[a-zA-Z0-9 ._-]*[a-zA-Z0-9])?\\.[a-zA-Z0-9_-]+$", - RegexOptions.CultureInvariant, + RegexOptions.CultureInvariant | RegexOptions.Singleline, matchTimeoutMilliseconds: 300)] private static partial Regex ValidFileNameRegex(); @@ -63,7 +63,7 @@ public static string GetFileName(string filePath, /// Regex object [GeneratedRegex( "\\.[a-zA-Z0-9]{1,4}$", - RegexOptions.CultureInvariant, + RegexOptions.NonBacktracking | RegexOptions.CultureInvariant, matchTimeoutMilliseconds: 100)] private static partial Regex FileNameWithoutExtensionRegex(); @@ -87,7 +87,7 @@ public static string GetFileNameWithoutExtension(string filePath) /// Regex object [GeneratedRegex( "[^.][a-zA-Z0-9]{1,4}$", - RegexOptions.CultureInvariant, + RegexOptions.NonBacktracking | RegexOptions.CultureInvariant, matchTimeoutMilliseconds: 100)] private static partial Regex FileExtensionWithoutDotRegex(); @@ -116,8 +116,8 @@ public static string GetFileExtensionWithoutDot(string filename) /// Regex object [GeneratedRegex( ".+(?=\\/[^/]+$)", - RegexOptions.CultureInvariant, - matchTimeoutMilliseconds: 200)] + RegexOptions.IgnoreCase | RegexOptions.Singleline, + matchTimeoutMilliseconds: 300)] private static partial Regex ParentPathRegex(); /// From 61b8ae7b55665c9200a5e1c97a0d67633894c6d6 Mon Sep 17 00:00:00 2001 From: Dion Date: Mon, 11 Mar 2024 11:47:43 +0100 Subject: [PATCH 10/13] rename metric name --- .../Metrics/DiskWatcherBackgroundTaskQueueMetrics.cs | 2 +- .../Metrics/ThumbnailBackgroundQueuedMetrics.cs | 2 +- .../Metrics/UpdateBackgroundQueuedMetrics.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/starsky/starsky.foundation.sync/Metrics/DiskWatcherBackgroundTaskQueueMetrics.cs b/starsky/starsky.foundation.sync/Metrics/DiskWatcherBackgroundTaskQueueMetrics.cs index 3ea09231c7..74cb51bf57 100644 --- a/starsky/starsky.foundation.sync/Metrics/DiskWatcherBackgroundTaskQueueMetrics.cs +++ b/starsky/starsky.foundation.sync/Metrics/DiskWatcherBackgroundTaskQueueMetrics.cs @@ -13,7 +13,7 @@ public class DiskWatcherBackgroundTaskQueueMetrics public DiskWatcherBackgroundTaskQueueMetrics(IMeterFactory meterFactory) { var meter = meterFactory.Create(ActivitySourceMeter.SyncNameSpace); - const string name = "_s." + nameof(DiskWatcherBackgroundTaskQueueMetrics); + const string name = "App." + nameof(DiskWatcherBackgroundTaskQueueMetrics); meter.CreateObservableGauge(name, ObserveValue); } diff --git a/starsky/starsky.foundation.worker/Metrics/ThumbnailBackgroundQueuedMetrics.cs b/starsky/starsky.foundation.worker/Metrics/ThumbnailBackgroundQueuedMetrics.cs index 0e4330d8bd..063718b915 100644 --- a/starsky/starsky.foundation.worker/Metrics/ThumbnailBackgroundQueuedMetrics.cs +++ b/starsky/starsky.foundation.worker/Metrics/ThumbnailBackgroundQueuedMetrics.cs @@ -13,7 +13,7 @@ public class ThumbnailBackgroundQueuedMetrics public ThumbnailBackgroundQueuedMetrics(IMeterFactory meterFactory) { var meter = meterFactory.Create(ActivitySourceMeter.WorkerNameSpace); - const string name = "_s." + nameof(ThumbnailBackgroundQueuedMetrics); + const string name = "App." + nameof(ThumbnailBackgroundQueuedMetrics); meter.CreateObservableGauge(name, ObserveValue); } diff --git a/starsky/starsky.foundation.worker/Metrics/UpdateBackgroundQueuedMetrics.cs b/starsky/starsky.foundation.worker/Metrics/UpdateBackgroundQueuedMetrics.cs index dab051bccd..d12d609d31 100644 --- a/starsky/starsky.foundation.worker/Metrics/UpdateBackgroundQueuedMetrics.cs +++ b/starsky/starsky.foundation.worker/Metrics/UpdateBackgroundQueuedMetrics.cs @@ -13,7 +13,7 @@ public class UpdateBackgroundQueuedMetrics public UpdateBackgroundQueuedMetrics(IMeterFactory meterFactory) { var meter = meterFactory.Create(ActivitySourceMeter.WorkerNameSpace); - const string name = "_s." + nameof(UpdateBackgroundQueuedMetrics); + const string name = "App." + nameof(UpdateBackgroundQueuedMetrics); meter.CreateObservableGauge(name, ObserveValue); } From dd71976fb68b950708a007b1e7a8a6433c627880 Mon Sep 17 00:00:00 2001 From: Dion Date: Mon, 11 Mar 2024 14:01:30 +0100 Subject: [PATCH 11/13] Change GetParentPath() to use --- .../Helpers/FilenamesHelper.cs | 29 ++++++++++--------- .../Helpers/FilenamesHelperTest.cs | 22 ++++++++++++-- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/starsky/starsky.foundation.platform/Helpers/FilenamesHelper.cs b/starsky/starsky.foundation.platform/Helpers/FilenamesHelper.cs index 1dcc4cbb8b..b1156ebabe 100644 --- a/starsky/starsky.foundation.platform/Helpers/FilenamesHelper.cs +++ b/starsky/starsky.foundation.platform/Helpers/FilenamesHelper.cs @@ -1,5 +1,6 @@ using System.IO; using System.Runtime.InteropServices; +using System.Text; using System.Text.RegularExpressions; namespace starsky.foundation.platform.Helpers @@ -108,20 +109,9 @@ public static string GetFileExtensionWithoutDot(string filename) } /// + /// Return UNIX style parent paths back /// Get Parent Regex /// unescaped regex: /.+(?=\/[^/]+$)/ - /// pre compiled regex - /// Regex.Match - /// - /// Regex object - [GeneratedRegex( - ".+(?=\\/[^/]+$)", - RegexOptions.IgnoreCase | RegexOptions.Singleline, - matchTimeoutMilliseconds: 300)] - private static partial Regex ParentPathRegex(); - - /// - /// Return UNIX style parent paths back /// /// unix style subPath /// parent folder path @@ -131,8 +121,21 @@ public static string GetParentPath(string? filePath) { return "/"; } + + var parts = filePath.TrimEnd('/').Split('/'); + if (parts.Length <= 2) + { + return "/"; + } + + var stringBuilder = new StringBuilder(); + for (var i = 0; i < parts.Length - 1; i++) + { + stringBuilder.Append(parts[i] + "/"); + } + + var result = stringBuilder.ToString().TrimEnd('/'); - var result = ParentPathRegex().Match(filePath).Value; return string.IsNullOrEmpty(result) ? "/" : PathHelper.RemoveLatestSlash(result); } } diff --git a/starsky/starskytest/starsky.foundation.platform/Helpers/FilenamesHelperTest.cs b/starsky/starskytest/starsky.foundation.platform/Helpers/FilenamesHelperTest.cs index 463f5b2cae..638fd9c044 100644 --- a/starsky/starskytest/starsky.foundation.platform/Helpers/FilenamesHelperTest.cs +++ b/starsky/starskytest/starsky.foundation.platform/Helpers/FilenamesHelperTest.cs @@ -209,6 +209,22 @@ public void GetFileExtensionWithoutDot_Should_Not_Return_Extension_With_Invalid_ // Assert Assert.AreEqual("txt", extension); } + + [TestMethod] + public void GetParentPath_AddSlash() + { + const string filePath = "/folder_no_content/"; + var result = FilenamesHelper.GetParentPath(filePath); + Assert.AreEqual("/", result); + } + + [TestMethod] + public void GetParentPath_AddSlash2() + { + const string filePath = "/folder_no_content/test.jpg/"; + var result = FilenamesHelper.GetParentPath(filePath); + Assert.AreEqual("/folder_no_content", result); + } [TestMethod] public void GetParentPath_ReturnsCorrectPath_WhenFilePathIsValid() @@ -240,11 +256,11 @@ public void GetParentPath_ReturnsSlash_WhenFilePathIsRoot() public void GetParentPath_ReturnsSlash_WhenFilePathIsNullOrEmpty() { // Arrange - string filePath2 = ""; + const string filePath2 = ""; // Act - string result1 = FilenamesHelper.GetParentPath(null); - string result2 = FilenamesHelper.GetParentPath(filePath2); + var result1 = FilenamesHelper.GetParentPath(null); + var result2 = FilenamesHelper.GetParentPath(filePath2); // Assert Assert.AreEqual("/", result1); From 9f1a74fb055f40ded02ee5b8dd00a62aaceb50f6 Mon Sep 17 00:00:00 2001 From: Dion van Velde Date: Mon, 11 Mar 2024 14:26:02 +0100 Subject: [PATCH 12/13] Update history.md --- history.md | 1 + 1 file changed, 1 insertion(+) diff --git a/history.md b/history.md index 2f1634fe11..da224d681a 100644 --- a/history.md +++ b/history.md @@ -55,6 +55,7 @@ Semantic Versioning 2.0.0 is from version 0.1.6+ - [x] (Fixed) _Back-end_ Warnings for Sonarcloud (PR #1445) - [x] (Fixed) _Front-end_ Fix list item status OkAndSame is not red anymore (PR #1445) - [x] (Removed) _Back-end_ Unused .NET cultures (PR #1453) +- [x] (Changed) _Back-end_ Change GetParentPath() to avoid regex due timeout (PR #1461) ## version 0.6.0-beta.2 - 2024-03-05 {#v0.6.0-beta.2} From dd14bb42c991dbd692df892de1f580b2a8d7a9df Mon Sep 17 00:00:00 2001 From: Dion Date: Mon, 11 Mar 2024 16:28:39 +0100 Subject: [PATCH 13/13] add comment --- starsky/starskytest/FakeCreateAn/CreateAnImage.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/starsky/starskytest/FakeCreateAn/CreateAnImage.cs b/starsky/starskytest/FakeCreateAn/CreateAnImage.cs index a99f4c91fd..f5946bf881 100644 --- a/starsky/starskytest/FakeCreateAn/CreateAnImage.cs +++ b/starsky/starskytest/FakeCreateAn/CreateAnImage.cs @@ -37,6 +37,7 @@ public class CreateAnImage Path.DirectorySeparatorChar).Replace("./",string.Empty); /// + /// Split line /// @see: https://superuser.com/a/1467266 and 80 chars /// [SuppressMessage("ReSharper", "StringLiteralTypo")]