mirror of
https://github.com/formbricks/formbricks.git
synced 2026-02-25 00:58:48 -06:00
fix: survey url incorrect in single use share dialoge (#1464)
This commit is contained in:
@@ -36,7 +36,7 @@ export default function LinkSingleUseSurveyModal({ survey, surveyBaseUrl }: Link
|
||||
return await Promise.all(promises);
|
||||
};
|
||||
|
||||
const defaultSurveyUrl = `${surveyBaseUrl}/${survey.id}`;
|
||||
const defaultSurveyUrl = `${surveyBaseUrl}/s/${survey.id}`;
|
||||
const [selectedSingleUseIds, setSelectedSingleIds] = useState<number[]>([]);
|
||||
|
||||
const linkTextRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
@@ -5,6 +5,7 @@ import { ENCRYPTION_KEY } from "./constants";
|
||||
const ALGORITHM = "aes256";
|
||||
const INPUT_ENCODING = "utf8";
|
||||
const OUTPUT_ENCODING = "hex";
|
||||
const BUFFER_ENCODING = ENCRYPTION_KEY.length === 32 ? "latin1" : "hex";
|
||||
const IV_LENGTH = 16; // AES blocksize
|
||||
|
||||
/**
|
||||
@@ -15,7 +16,7 @@ const IV_LENGTH = 16; // AES blocksize
|
||||
* @returns Encrypted value using key
|
||||
*/
|
||||
export const symmetricEncrypt = function (text: string, key: string) {
|
||||
const _key = Buffer.from(key, "latin1");
|
||||
const _key = Buffer.from(key, BUFFER_ENCODING);
|
||||
const iv = crypto.randomBytes(IV_LENGTH);
|
||||
|
||||
const cipher = crypto.createCipheriv(ALGORITHM, _key, iv);
|
||||
@@ -32,7 +33,7 @@ export const symmetricEncrypt = function (text: string, key: string) {
|
||||
* @param key Key used to decrypt value must be 32 bytes for AES256 encryption algorithm
|
||||
*/
|
||||
export const symmetricDecrypt = function (text: string, key: string) {
|
||||
const _key = Buffer.from(key, "latin1");
|
||||
const _key = Buffer.from(key, BUFFER_ENCODING);
|
||||
|
||||
const components = text.split(":");
|
||||
const iv_from_ciphertext = Buffer.from(components.shift() || "", OUTPUT_ENCODING);
|
||||
|
||||
Reference in New Issue
Block a user