Skip to content

Commit

Permalink
[INJIVER-611] fix:Unable to upload capital extension QR codes
Browse files Browse the repository at this point in the history
Signed-off-by: srikanth716 <[email protected]>
  • Loading branch information
srikanth716 committed Sep 10, 2024
1 parent 8ccbb61 commit 56d5864
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions inji-verify/src/utils/qr-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ import { pdfToQrData } from "./pdfToQrData";
export const scanFilesForQr = async (selectedFile) => {
let scanResult = { data: null, error: null };
const html5QrCode = new Html5Qrcode("upload-qr");

const fileNameAndExtension = selectedFile.name.split('.');
const fileExtension = fileNameAndExtension.pop();
const newFileName = `${fileNameAndExtension.join('.')}.${fileExtension.toLowerCase()}`;
const uploadedFile = new File([selectedFile], newFileName, { type: selectedFile.type });

try {
if (selectedFile.type === "application/pdf") {
const qrResult = await pdfToQrData(selectedFile);
if (uploadedFile.type === "application/pdf") {
const qrResult = await pdfToQrData(uploadedFile);
scanResult.data = qrResult;
} else {
const qrData = await html5QrCode.scanFile(selectedFile);
const qrData = await html5QrCode.scanFile(uploadedFile);
scanResult.data = qrData;
}
} catch (e) {
Expand Down

0 comments on commit 56d5864

Please sign in to comment.