rbelavadi commented on code in PR #6493:
URL: https://github.com/apache/texera/pull/6493#discussion_r3624331612
##########
frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.ts:
##########
@@ -908,6 +915,50 @@ export class DatasetDetailComponent implements OnInit {
});
}
+ onSaveDatasetName(): void {
+ if (!this.did) {
+ return;
+ }
+ // Sanitize using the same rules as dataset creation: trim leading
whitespace,
+ // collapse runs of non-alphanumeric characters to a single "-", then
lowercase.
+ const sanitizedName = this.editedDatasetName
+ .trimStart()
+ .replace(/[^a-zA-Z0-9]+/g, "-")
+ .toLowerCase();
Review Comment:
This is superseded by the fix for a related comment above, onSaveDatasetName
no longer does local sanitization at all; it now calls the shared
validateDatasetName (added in #6426), which rejects empty/whitespace-only input
via its ^[A-Za-z0-9_-]+$ pattern requiring at least one character, showing an
error instead of persisting an empty name. This also addresses the "extract
into a shared util" suggestion, since validation is now fully centralized in
validateDatasetName rather than being duplicated locally.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]