mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 21:40:31 +00:00
requested changes
This commit is contained in:
@@ -76,7 +76,7 @@ export const ShareSecretForm = ({ isPublic, value }: Props) => {
|
||||
try {
|
||||
const expiresAt = new Date(new Date().getTime() + Number(expiresIn));
|
||||
|
||||
const { id, hashedHex } = await createSharedSecret.mutateAsync({
|
||||
const { id } = await createSharedSecret.mutateAsync({
|
||||
name,
|
||||
password,
|
||||
secretValue: secret,
|
||||
@@ -85,7 +85,7 @@ export const ShareSecretForm = ({ isPublic, value }: Props) => {
|
||||
accessType
|
||||
});
|
||||
|
||||
setSecretLink(`${window.location.origin}/shared/secret/${id}-${hashedHex}`);
|
||||
setSecretLink(`${window.location.origin}/shared/secret/${id}`);
|
||||
reset();
|
||||
|
||||
setCopyTextSecret("secret");
|
||||
|
||||
@@ -13,23 +13,33 @@ import { PasswordContainer, SecretContainer, SecretErrorContainer } from "./comp
|
||||
const extractDetailsFromUrl = (router: NextRouter) => {
|
||||
const { id, key: urlEncodedKey } = router.query;
|
||||
|
||||
const idString = id as string;
|
||||
|
||||
if (!idString) {
|
||||
return {
|
||||
id: "",
|
||||
hashedHex: "",
|
||||
key: null
|
||||
};
|
||||
}
|
||||
|
||||
if (urlEncodedKey) {
|
||||
const [hashedHex, key] = urlEncodedKey ? urlEncodedKey.toString().split("-") : ["", ""];
|
||||
|
||||
return {
|
||||
id: id as string,
|
||||
id: idString,
|
||||
hashedHex,
|
||||
key
|
||||
};
|
||||
}
|
||||
|
||||
// its like this {uuid}-{hex} so example: idpart1-idpart2-idpart3-idpart4-hex
|
||||
const extractedId = id?.toString().split("-").slice(0, 5).join("-");
|
||||
const extractedHex = id?.toString().split("-").slice(5).join("-");
|
||||
// get the first 36 characters as id and the rest as hex
|
||||
const idPart = idString.substring(0, 36);
|
||||
const hexPart = idString.substring(36);
|
||||
|
||||
return {
|
||||
id: extractedId || "",
|
||||
hashedHex: extractedHex || "",
|
||||
id: idPart || "",
|
||||
hashedHex: hexPart || "",
|
||||
key: null
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user