Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to https://github.com/OpenAS2/OpenAs2App/issues/349 #350

Merged
merged 1 commit into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions WebUI/src/components/CertificatesAdmin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
import FormCustom from "./FormCustom";
import TableCustom from "./TableCustom";
import CertificateEditor from "./CertificateEditor";

import Utils from "../utils";
import Swal from "sweetalert2";
var _ = require("lodash");
Expand Down Expand Up @@ -380,9 +379,10 @@ export default {
console.log("item.....", this.item);
var oFile = file;
console.log(file);
// filter for image files
var rFilter = /^(application\/x-x509-ca-cert|application\/x-pkcs12)$/i;
if (!rFilter.test(oFile.type)) {
// filter for certificate files
var rFilter = /\.(pem)$/i;
var fileName = oFile.name;
if (!rFilter.test(fileName)) {
alert("Error invalid file-type");
return;
}
Expand All @@ -395,13 +395,18 @@ export default {
oReader.onload = function (e) {
console.log("edit---->", e.target.result);
var PEM = e.target.result;
PEM = PEM.replace("-----BEGIN CERTIFICATE-----", "").replace(
"-----END CERTIFICATE-----",
""
);
PEM = PEM.replace(/[^A-Za-z0-9+/=]+/gm, "");
that.item.data = PEM;
that.changedCert();
try {
PEM = PEM.replace("-----BEGIN CERTIFICATE-----", "").replace(
"-----END CERTIFICATE-----","");
PEM = PEM.replace(/[^A-Za-z0-9+/=]+/gm, "");
that.item.data = PEM;
that.changedCert();
console.log("Read certificate successfully")
} catch (ex) {
console.log("Error reading certificate", ex)
alert("Error reading certificate");
return;
}
};
oReader.readAsText(oFile);
},
Expand Down
Loading
Loading