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: fix invalid image URL generation #128

Merged
merged 1 commit into from
Nov 12, 2024
Merged
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
20 changes: 12 additions & 8 deletions src/components/InfoModal.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import PreviewOutlinedIcon from '@mui/icons-material/PreviewOutlined';
import Accordion from '@mui/material/Accordion';
import AccordionDetails from '@mui/material/AccordionDetails';
import AccordionSummary from '@mui/material/AccordionSummary';
import Box from '@mui/material/Box';
import Button from '@mui/material/Button';
import Typography from '@mui/material/Typography';
import Modal from '@mui/material/Modal';
import { useState } from 'react';
import axios from 'axios';
import PreviewOutlinedIcon from '@mui/icons-material/PreviewOutlined';
import Typography from '@mui/material/Typography';
import Grid from '@mui/material/Unstable_Grid2';
import Accordion from '@mui/material/Accordion';
import AccordionSummary from '@mui/material/AccordionSummary';
import AccordionDetails from '@mui/material/AccordionDetails';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import axios from 'axios';
import { useState } from 'react';
import DeleteButton from './DeleteButton';

const style = {
Expand All @@ -32,6 +32,10 @@ export default function ModalInfo({barcode}: ModalInfoProps) {

const [open, setOpen] = useState(false);
const buildUrl = (barcode: string, imageId: string, def: string, rev?: string) => {
// fill the barcode with 0 if it's not 13 characters long
if (barcode.length < 13) {
barcode = barcode.padStart(13, '0');
}
// split the barcode into 4 parts
const part1 = barcode.slice(0, 3);
const part2 = barcode.slice(3, 6);
Expand Down