-
Notifications
You must be signed in to change notification settings - Fork 298
Bug infinate loading #645
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
base: develop
Are you sure you want to change the base?
Bug infinate loading #645
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,10 @@ | |
| </p> | ||
| </div> | ||
|
|
||
| <div class="flex flex-col py-5 gap-3"> | ||
| <div v-if="createTeam.error" class="flex flex-col py-5 gap-3"> | ||
| <ErrorMessage class="text-center" :message="sanitizedError" /> | ||
| </div> | ||
| <div v-else class="flex flex-col py-5 gap-3"> | ||
| <LoadingIndicator class="size-5 self-center" /> | ||
| <div class="text-sm text-center">Just a minute...</div> | ||
| </div> | ||
|
|
@@ -28,21 +31,30 @@ | |
| </template> | ||
|
|
||
| <script setup> | ||
| import { createResource, FormControl, LoadingIndicator } from 'frappe-ui' | ||
| import { ref, computed } from 'vue' | ||
| import { computed, onMounted } from 'vue' | ||
| import { ErrorMessage, LoadingIndicator } from 'frappe-ui' | ||
| import FrappeDriveLogo from '@/components/FrappeDriveLogo.vue' | ||
| import { useRoute } from 'vue-router' | ||
| import { useStore } from 'vuex' | ||
| import { createTeam } from '@/resources/permissions' | ||
|
|
||
| const route = useRoute() | ||
|
|
||
| createTeam.submit( | ||
| { personal: 1 }, | ||
| { | ||
| onSuccess: (data) => { | ||
| if (data) window.location.replace(route.query['redirect-to'] || '/drive') | ||
| const sanitizedError = computed(() => { | ||
| const raw = createTeam.error?.messages?.[0] ?? '' | ||
| const el = document.createElement('div') | ||
| el.textContent = raw | ||
| return el.innerHTML.replace(/<(\/?strong)>/g, '<$1>') | ||
| }) | ||
|
Comment on lines
+43
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Prompt To Fix With AIThis is a comment left during a code review.
Path: frontend/src/pages/Setup.vue
Line: 43-48
Comment:
**Bespoke HTML sanitization passed to component as trusted HTML**
`sanitizedError` constructs a string containing real `<strong>` tags from a server-supplied error message, then passes it to `<ErrorMessage :message="sanitizedError" />`. If `ErrorMessage` from frappe-ui renders the `message` prop with `v-html` (rather than `{{ message }}`), any server-controlled string that happens to embed `<strong>` alongside other payloads could bypass the regex — e.g. a multi-message response or a future server change widening the allowed tags. If `ErrorMessage` does NOT render with `v-html`, the entire sanitization round-trip is wasted and `<strong>` tags will appear as literal text instead of bold. In either case, prefer passing `createTeam.error?.messages?.[0]` directly (plain text), or use a proper sanitizer like DOMPurify if HTML rendering is genuinely required.
How can I resolve this? If you propose a fix, please make it concise.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i could add DOMPurify but it is a additional Dependency and just {{}} shows html tags which looks ugly, so this is sort of a middle ground There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair point. After checking, Your sanitization logic is actually sound on closer inspection: I withdraw my concern — this is a reasonable middle ground given the constraints. The implementation is safe as written. Tip: You can customize Greptile's behavior for this repo with |
||
|
|
||
| onMounted(() => { | ||
| createTeam.submit( | ||
| { personal: 1 }, | ||
| { | ||
| onSuccess: (data) => { | ||
| if (data) window.location.replace(route.query['redirect-to'] || '/drive') | ||
| }, | ||
| }, | ||
| } | ||
| ) | ||
| ) | ||
| }) | ||
| </script> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useStoreis imported but never referenced in the component after the refactor.Prompt To Fix With AI
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!