Skip to content

Los app #6543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Los app #6543

wants to merge 3 commits into from

Conversation

tor-nav
Copy link
Collaborator

@tor-nav tor-nav commented Aug 12, 2025

No description provided.

@tor-nav tor-nav requested a review from a team as a code owner August 12, 2025 10:34
@tor-nav tor-nav marked this pull request as draft August 12, 2025 10:34
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
75.0% Duplication on New Code (required ≤ 10%)

See analysis details on SonarQube Cloud

msw: {
handlers: [
http.get(LosUrl.KODEVERK_LOS, () => HttpResponse.json(alleKodeverkLos)),
http.get(LosUrl.HENT_OPPGAVER_FOR_AVDELING.replace('ø', '%C3%B8'), () =>

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This replaces only the first occurrence of '\u00f8'.

Copilot Autofix

AI 5 days ago

To fix the problem, we should ensure that all occurrences of 'ø' in the string are replaced with '%C3%B8', not just the first. The best way to do this is to use a regular expression with the global (g) flag: .replace(/ø/g, '%C3%B8'). This change should be made directly on line 57, replacing the current .replace('ø', '%C3%B8') with .replace(/ø/g, '%C3%B8'). No additional imports or definitions are needed, as this is standard JavaScript functionality.


Suggested changeset 1
apps/los-avdelingsleder/src/nokkeltall/fordelingAvBehandlingstype/FordelingAvBehandlingstypePanel.stories.tsx

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/apps/los-avdelingsleder/src/nokkeltall/fordelingAvBehandlingstype/FordelingAvBehandlingstypePanel.stories.tsx b/apps/los-avdelingsleder/src/nokkeltall/fordelingAvBehandlingstype/FordelingAvBehandlingstypePanel.stories.tsx
--- a/apps/los-avdelingsleder/src/nokkeltall/fordelingAvBehandlingstype/FordelingAvBehandlingstypePanel.stories.tsx
+++ b/apps/los-avdelingsleder/src/nokkeltall/fordelingAvBehandlingstype/FordelingAvBehandlingstypePanel.stories.tsx
@@ -54,7 +54,7 @@
     msw: {
       handlers: [
         http.get(LosUrl.KODEVERK_LOS, () => HttpResponse.json(alleKodeverkLos)),
-        http.get(LosUrl.HENT_OPPGAVER_FOR_AVDELING.replace('ø', '%C3%B8'), () =>
+        http.get(LosUrl.HENT_OPPGAVER_FOR_AVDELING.replace(/ø/g, '%C3%B8'), () =>
           HttpResponse.json(OPPGAVER_FOR_AVDELING),
         ),
       ],
EOF
@@ -54,7 +54,7 @@
msw: {
handlers: [
http.get(LosUrl.KODEVERK_LOS, () => HttpResponse.json(alleKodeverkLos)),
http.get(LosUrl.HENT_OPPGAVER_FOR_AVDELING.replace('ø', '%C3%B8'), () =>
http.get(LosUrl.HENT_OPPGAVER_FOR_AVDELING.replace(/ø/g, '%C3%B8'), () =>
HttpResponse.json(OPPGAVER_FOR_AVDELING),
),
],
Copilot is powered by AI and may make mistakes. Always verify output.
msw: {
handlers: [
http.get(LosUrl.KODEVERK_LOS, () => HttpResponse.json(alleKodeverkLos)),
http.get(LosUrl.HENT_OPPGAVER_PER_DATO.replace('ø', '%C3%B8'), () => HttpResponse.json(OPPGAVER_PER_DATO)),

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This replaces only the first occurrence of '\u00f8'.

Copilot Autofix

AI 5 days ago

The best way to fix this problem is to ensure that all occurrences of 'ø' in the string are replaced, not just the first. This can be done by using a regular expression with the global flag: .replace(/ø/g, '%C3%B8'). However, since the intention is to encode a URL, the most robust and future-proof solution is to use the built-in encodeURI or encodeURIComponent functions, which handle all necessary character encodings for URLs. In this context, if the entire URL needs to be encoded, use encodeURI; if only a component (such as a path segment or query parameter), use encodeURIComponent. Since the code is replacing 'ø' with its percent-encoded form, it is likely that the intention is to encode the URL. Therefore, replace .replace('ø', '%C3%B8') with encodeURI(LosUrl.HENT_OPPGAVER_PER_DATO). This change should be made on line 65 of apps/los-avdelingsleder/src/nokkeltall/tilBehandling/TilBehandlingPanel.stories.tsx. No additional imports are needed, as encodeURI is a global JavaScript function.


Suggested changeset 1
apps/los-avdelingsleder/src/nokkeltall/tilBehandling/TilBehandlingPanel.stories.tsx

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/apps/los-avdelingsleder/src/nokkeltall/tilBehandling/TilBehandlingPanel.stories.tsx b/apps/los-avdelingsleder/src/nokkeltall/tilBehandling/TilBehandlingPanel.stories.tsx
--- a/apps/los-avdelingsleder/src/nokkeltall/tilBehandling/TilBehandlingPanel.stories.tsx
+++ b/apps/los-avdelingsleder/src/nokkeltall/tilBehandling/TilBehandlingPanel.stories.tsx
@@ -62,7 +62,7 @@
     msw: {
       handlers: [
         http.get(LosUrl.KODEVERK_LOS, () => HttpResponse.json(alleKodeverkLos)),
-        http.get(LosUrl.HENT_OPPGAVER_PER_DATO.replace('ø', '%C3%B8'), () => HttpResponse.json(OPPGAVER_PER_DATO)),
+        http.get(encodeURI(LosUrl.HENT_OPPGAVER_PER_DATO), () => HttpResponse.json(OPPGAVER_PER_DATO)),
       ],
     },
   },
EOF
@@ -62,7 +62,7 @@
msw: {
handlers: [
http.get(LosUrl.KODEVERK_LOS, () => HttpResponse.json(alleKodeverkLos)),
http.get(LosUrl.HENT_OPPGAVER_PER_DATO.replace('ø', '%C3%B8'), () => HttpResponse.json(OPPGAVER_PER_DATO)),
http.get(encodeURI(LosUrl.HENT_OPPGAVER_PER_DATO), () => HttpResponse.json(OPPGAVER_PER_DATO)),
],
},
},
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant