]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
squid: mgr/dashboard: Forbid snapshot name "." and any containing "/". 59995/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>
Thu, 26 Sep 2024 11:39:21 +0000 (17:09 +0530)
Fixes: https://tracker.ceph.com/issues/68198
Signed-off-by: Dnyaneshwari Talwekar <dtalweka@redhat.com>
(cherry picked from commit 8a101ef9be5cfaaa9d9703e4ccdda9106416c362)

Conflicts:
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.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts

index e84ecab695a6c7349e1f49f83ca807c05cea7169..a42ecf1e021a3e531cdb64062798903d117bc5eb 100644 (file)
@@ -27,6 +27,9 @@
                   i18n>This field is required.</span>
             <span *ngIf="((mirroring === 'snapshot') ? true : null) && (snapshotForm.getValue('mirrorImageSnapshot') === true) ? true: null"
                   i18n>Snapshot mode is enabled on image <b>{{ imageName }}</b>: snapshot names are auto generated</span>
+            <span *ngIf="snapshotForm.showError('snapshotName', formDir, 'pattern')"
+                  class="invalid-feedback"
+                  i18n>The snapshot name cannot start with "." and cannot contain "/" and "@".</span>
           </div>
         </div>
         <ng-container *ngIf="(mirroring === 'snapshot') ? true : null">
index a9fb074261e445e3e6bbb94c29c091717b8c43a5..3c455565b6c7625cdfd28fadf90c300cd3ae2102 100644 (file)
@@ -51,7 +51,7 @@ export class RbdSnapshotFormModalComponent implements OnInit {
   createForm() {
     this.snapshotForm = new CdFormGroup({
       snapshotName: new UntypedFormControl('', {
-        validators: [Validators.required]
+        validators: [Validators.required, Validators.pattern(/^(?!\.)[^/@]+$/)]
       }),
       mirrorImageSnapshot: new UntypedFormControl(false, {})
     });