Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 9e1765ef authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

[EDELIVERY-11391] fix duplicate import not working for truststore certificates

parent 1a9ae811
No related branches found
No related tags found
No related merge requests found
Pipeline #209646 failed
......@@ -30,6 +30,7 @@
<mat-toolbar-row class="smp-toolbar-row">
<div class="custom-file-upload">
<input #fileInput type="file" id="custom-file-upload" accept=".cer,.crt,.pem,.der"
[(ngModel)]="inputFileValue"
(change)="uploadCertificate($event)">
<button mat-raised-button mat-flat-button color="primary"
(click)="fileInput.click()">{{ "admin.truststore.button.add.certificate" | translate }}
......
......@@ -25,10 +25,11 @@ export class AdminTruststoreComponent implements OnInit, OnDestroy, AfterViewIn
trustedCertificateList: CertificateRo[];
private updateTruststoreCertificatesSub: Subscription = Subscription.EMPTY;
private updateTruststoreCertificateSub: Subscription = Subscription.EMPTY;
// purpose of this value is to reset the file input after the file is uploaded
inputFileValue: string = '';
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
constructor(private truststoreService: AdminTruststoreService,
private alertService: AlertMessageService,
private dialog: MatDialog,
......@@ -111,10 +112,11 @@ export class AdminTruststoreComponent implements OnInit, OnDestroy, AfterViewIn
this.selected = selected;
}
uploadCertificate(event) {
const file = event.target.files[0];
this.truststoreService.uploadCertificate$(file);
// reset the file input
this.inputFileValue = '';
}
async onDeleteSelectedCertificateClicked() {
......
......@@ -102,9 +102,8 @@ public class TruststoreAdminController {
} catch (NoSuchAlgorithmException | KeyStoreException | IOException | CertificateException e) {
String message = "Error occurred while storing the certificate!";
LOG.error(message, e);
creatEmptyResponse(null, EntityROStatus.ERROR, message);
return creatEmptyResponse(null, EntityROStatus.ERROR, message);
}
return null;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment