fix(cropper): alias the queue's core domain to uc; show server error text

Saving failed with 400 'Unknown domain.' because queue items carry the
legacy domain 'core', which the old bot mapped to 'uc' for a2loft URLs —
my domain validation (added in the review pass) rejected it. The save now
applies the same alias before validating and forwarding.

Also: the client showed axios's generic 'Request failed with status code
400' because the catch destructured error.message; all cropper handlers now
prefer the server's response.data.message (errMessage helper), so the real
reason is visible.

Verified: save with a 'core' item forwards to /identity/uc/profile/picture;
a 400 shows 'Unknown domain.'; 46 tests.
This commit is contained in:
2026-10-01 10:35:02 +01:00
parent 001290a789
commit 645d3d2bc9
3 changed files with 56 additions and 12 deletions
+16 -10
View File
@@ -95,6 +95,12 @@ Vue.config.ignoredElements = [/^cds-/];
},
methods: {
/** axios hides the server's reason in response.data — prefer it. */
errMessage: function (error, fallback) {
return (error && error.response && error.response.data && error.response.data.message) ||
(error && error.message) || fallback;
},
toast: function (kind, title, caption) {
var self = this;
var id = ++toastSeq;
@@ -157,8 +163,8 @@ Vue.config.ignoredElements = [/^cds-/];
);
this.agent = review.data.ok ? review.data.data : null;
}
} catch ({ message }) {
this.toast('error', 'Operation Failed', message);
} catch (error) {
this.toast('error', 'Operation Failed', this.errMessage(error, 'Could not load the picture.'));
} finally {
this.busy.load = false;
}
@@ -186,8 +192,8 @@ Vue.config.ignoredElements = [/^cds-/];
var fr = new FileReader();
fr.onload = function () { self.cleanedImage = fr.result; };
fr.readAsDataURL(blob);
} catch ({ message }) {
this.toast('error', 'Image Cleanup Failed', message);
} catch (error) {
this.toast('error', 'Image Cleanup Failed', this.errMessage(error, 'Cleanup failed.'));
} finally {
this.busy.clean = false;
}
@@ -232,8 +238,8 @@ Vue.config.ignoredElements = [/^cds-/];
this.toast('success', 'Review Sent', 'Profile owner has been notified of the review.');
}
this.reset();
} catch ({ message }) {
this.toast('error', 'Operation Failed', message);
} catch (error) {
this.toast('error', 'Operation Failed', this.errMessage(error, 'Review failed.'));
} finally {
this.busy.review = false;
}
@@ -251,8 +257,8 @@ Vue.config.ignoredElements = [/^cds-/];
}
this.toast('success', 'Removed!', data.message || '');
this.reset();
} catch ({ message }) {
this.toast('error', 'Not Removed', message);
} catch (error) {
this.toast('error', 'Not Removed', this.errMessage(error, 'Removal failed.'));
} finally {
this.busy.review = false;
}
@@ -276,8 +282,8 @@ Vue.config.ignoredElements = [/^cds-/];
}
this.toast('success', 'Saved', 'Picture saved for ' + this.message.message.caption);
this.reset();
} catch ({ message }) {
this.toast('error', 'Not Saved', message);
} catch (error) {
this.toast('error', 'Not Saved', this.errMessage(error, 'Save failed.'));
} finally {
this.busy.save = false;
}