]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Forbid snapshot name "." and any containing "/". 59946/head
authorDnyaneshwari <dnyaneshwari@li-9c9fbecc-2d5c-11b2-a85c-e2a7cc8a424f.ibm.com>
Tue, 24 Sep 2024 06:23:01 +0000 (11:53 +0530)
committerDnyaneshwari <dnyaneshwari@li-9c9fbecc-2d5c-11b2-a85c-e2a7cc8a424f.ibm.com>
Wed, 25 Sep 2024 16:41:59 +0000 (22:11 +0530)
Fixes: https://tracker.ceph.com/issues/68198
Signed-off-by: Dnyaneshwari Talwekar <dtalweka@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts

index 1b160b18130a050e6c111ac5e49bdb20698e802c..ba55c9f2a4dabc74bebb00830bcfdac9ae2813f5 100644 (file)
@@ -37,6 +37,9 @@
           <span *ngIf="snapshotForm.showError('snapshotName', formDir, 'required')"
                 class="invalid-feedback"
                 i18n>This field is required.</span>
+          <span *ngIf="snapshotForm.showError('snapshotName', formDir, 'pattern')"
+                class="invalid-feedback"
+                i18n>The snapshot name cannot start with "." and cannot contain "/" and "@".</span>
         </ng-template>
       </div>
 
index 00f84fcc860d41efb0b1281df8544d9074357074..0247a5c61f4d636cb7912be7a544f27f0dc22181 100644 (file)
@@ -53,7 +53,7 @@ export class RbdSnapshotFormModalComponent extends BaseModal implements OnInit {
   createForm() {
     this.snapshotForm = new CdFormGroup({
       snapshotName: new UntypedFormControl('', {
-        validators: [Validators.required]
+        validators: [Validators.required, Validators.pattern(/^(?!\.)[^/@]+$/)]
       }),
       mirrorImageSnapshot: new UntypedFormControl(false, {})
     });