diff --git a/packages/bruno-app/src/components/CollectionSettings/ClientCertSettings/index.js b/packages/bruno-app/src/components/CollectionSettings/ClientCertSettings/index.js index ba1debdec..caa825dfc 100644 --- a/packages/bruno-app/src/components/CollectionSettings/ClientCertSettings/index.js +++ b/packages/bruno-app/src/components/CollectionSettings/ClientCertSettings/index.js @@ -17,6 +17,8 @@ const ClientCertSettings = ({ root, clientCertConfig, onUpdate, onRemove }) => { const keyFilePathInputRef = useRef(); const pfxFilePathInputRef = useRef(); + const [pathType, setPathType] = useState('absolute'); + const formik = useFormik({ initialValues: { domain: '', @@ -69,13 +71,17 @@ const ClientCertSettings = ({ root, clientCertConfig, onUpdate, onRemove }) => { const getFile = (e) => { if (e.files?.[0]?.path) { - let relativePath; - if (isWindowsOS()) { - relativePath = slash(path.win32.relative(root, e.files[0].path)); + let filePath; + if (pathType === 'relative') { + if (isWindowsOS()) { + filePath = slash(path.win32.relative(root, e.files[0].path)); + } else { + filePath = path.posix.relative(root, e.files[0].path); + } } else { - relativePath = path.posix.relative(root, e.files[0].path); + filePath = e.files[0].path; } - formik.setFieldValue(e.name, relativePath); + formik.setFieldValue(e.name, filePath); } }; @@ -100,6 +106,10 @@ const ClientCertSettings = ({ root, clientCertConfig, onUpdate, onRemove }) => { } }; + const handlePathType = (e) => { + setPathType(e.target.value); + } + return (
Add client certificates to be used for specific domains.
@@ -163,7 +173,7 @@ const ClientCertSettings = ({ root, clientCertConfig, onUpdate, onRemove }) => { /> Cert -