fix(billing): guard window.location.href against non-string payload#2464
Open
walidsaleh wants to merge 89 commits into
Open
fix(billing): guard window.location.href against non-string payload#2464walidsaleh wants to merge 89 commits into
walidsaleh wants to merge 89 commits into
Conversation
chore: merge 'main-hotfix' into 'main'
chore: merge 'main-hotfix' into 'main'
(cherry picked from commit 7d08a76)
chore: frappe dependency change (backport frappe#2190)
chore: merge 'main-hotfix' into 'main'
chore: merge 'main-hotfix' into 'main'
chore: merge `develop` into `main-hotfix`
(cherry picked from commit 99397ad)
(cherry picked from commit 89505ea)
(cherry picked from commit 400c950)
fix: course progress updated for scorm and video end event (backport frappe#2247)
(cherry picked from commit 029d76c)
(cherry picked from commit 71c13d6)
(cherry picked from commit 5b50701)
…2260 fix: misc ui improvements (backport frappe#2260)
(cherry picked from commit bb1b1f6)
fix: prevent path transversals in lms (backport frappe#2274)
chore: merge 'main-hotfix' into 'main'
chore: merge `develop` into `main-hotfix`
(cherry picked from commit c3e3337)
…2282 fix: prevent unauthorised enrollments in paid courses (backport frappe#2282)
chore: merge `develop` into `main-hotfix`
(cherry picked from commit f244a6c)
perf: refactor course outline and lesson to use qb (backport frappe#2381)
(cherry picked from commit 1207b01)
(cherry picked from commit 308a926)
(cherry picked from commit 629a6ee)
(cherry picked from commit 538edbb)
…2377 fix: user roles are removed on uninstall (backport frappe#2377)
…2376 fix: timezone now renders for courses and batches (backport frappe#2376)
…2383 fix(quiz): exam submissions and scope check_answer (backport frappe#2383)
…2367 feat: add empty states to settings (backport frappe#2367)
…n-hotfix chore: merge `develop` into `main-hotfix`
…-main chore: merge main-hotfix into main
(cherry picked from commit c826e95)
fix: system manager permissions are set properly on install (backport frappe#2399)
chore: merge `develop` into `main-hotfix`
…/main-hotfix-to-main-v2 # Conflicts: # lms/patches.txt
…ain-v2 chore: merge `main hotfix` to `main`
chore: merge `develop` into `main-hotfix`
chore: merge `main-hotfix` into `main`
Closes frappe#2459 Billing.vue's onSuccess handler does 'window.location.href = data' assuming data is a string URL. When the backend returns a non-string payload (e.g. an error dict like {messages: [...]}), the browser navigates to '/lms/billing/course/[object Object]' and the student lands on a 404 page. Guard the assignment with a typeof check. If data is not a string, show a generic error toast via the existing toast.error + __() pattern instead of navigating to a broken URL. This is the second line of defense. The first line is the upstream fix for get_payment_link (frappe#2457), which now throws ValidationError instead of returning a dict, so onError handles the typical case. This onSuccess guard catches any future endpoint that may return a non-URL payload.
f772a4e to
91491e9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2459
What
Billing.vue's
onSuccesshandler doeswindow.location.href = data,assuming
datais a string URL. When the backend returns a non-stringpayload (e.g. an error dict like
{messages: [...]}), the browsernavigates to
/lms/billing/course/[object Object]and the studentlands on a 404 page.
Why
The student gets stuck on a broken URL with no useful error message.
The actual cause is hidden because
String({...})produces[object Object], which gives the operator no clue about whatwent wrong.
How
Guard the assignment with a
typeof === 'string'check. Ifdatais not a string, show a generic error toast via the existing
toast.error+__()pattern instead of navigating to a broken URL.This is the second line of defense. The first line is the upstream
fix for
get_payment_link(#2457), which now throwsValidationErrorinstead of returning a dict, soonErrorhandlesthe typical case. This
onSuccessguard catches any future endpointthat may return a non-URL payload.