Skip to content

Commit

Permalink
Fix base 64 images (#952)
Browse files Browse the repository at this point in the history
* fix(backoffice-v2): now checking if an image url is a url and not base64, and updated seed

* refactor(backoffice-v2): removed untintentional code

* revert(backoffice-v2): returned documents data to be inline
  • Loading branch information
Omri-Levy authored Aug 22, 2023
1 parent feac15a commit 8b5dc0c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { BallerineImage } from '../../atoms/BallerineImage';
import { forwardRef, useCallback, useEffect, useState } from 'react';
import { ctw } from '../../../utils/ctw/ctw';
import { useImageViewerContext } from './hooks/useImageViewerContext/useImageViewerContext';
import { useSelectedImage } from './hooks/useSelectedImage/useSelectedImage';
import { TSelectedImageProps } from './interfaces';

Expand Down
10 changes: 5 additions & 5 deletions apps/backoffice-v2/src/pages/Entity/hooks/useTasks/useTasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ import {
omitPropsFromObject,
} from '../useEntity/utils';
import { getDocumentsByCountry, isObject } from '@ballerine/common';
import * as React from 'react';
import { ComponentProps, useMemo } from 'react';
import { toStartCase } from '../../../../common/utils/to-start-case/to-start-case';

import { octetToFileType } from '../../../../common/octet-to-file-type/octet-to-file-type';
import { useCaseDecision } from '../../components/Case/hooks/useCaseDecision/useCaseDecision';
import { X } from 'lucide-react';
import * as React from 'react';
import { useRevisionTaskByIdMutation } from '../../../../domains/entities/hooks/mutations/useRevisionTaskByIdMutation/useRevisionTaskByIdMutation';
import { MotionBadge } from '../../../../common/components/molecules/MotionBadge/MotionBadge';
import { z } from 'zod';

const motionProps: ComponentProps<typeof MotionBadge> = {
exit: { opacity: 0, transition: { duration: 0.2 } },
Expand Down Expand Up @@ -274,10 +275,9 @@ export const useTasks = ({
title: `${convertSnakeCaseToTitleCase(category)} - ${convertSnakeCaseToTitleCase(
docType,
)}${metadata?.side ? ` - ${metadata?.side}` : ''}`,
imageUrl:
type === 'pdf'
? octetToFileType(results[docIndex][pageIndex], `application/${type}`)
: results[docIndex][pageIndex],
imageUrl: z.string().url().safeParse(results[docIndex][pageIndex]).success
? results[docIndex][pageIndex]
: octetToFileType(results[docIndex][pageIndex], `application/${type}`),
fileType: type,
})) ?? [],
},
Expand Down
4 changes: 2 additions & 2 deletions services/workflows-service/scripts/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ async function seed(bcryptSalt: string | number) {
{
provider: 'http',
uri: imageUri3,
type: 'pdf',
type: 'png',
ballerineFileId: await persistImageFile(client, imageUri3, project1.id),
data: '',
metadata: {},
Expand Down Expand Up @@ -418,7 +418,7 @@ async function seed(bcryptSalt: string | number) {
{
provider: 'http',
uri: imageUri3,
type: 'pdf',
type: 'png',
data: '',
ballerineFileId: await persistImageFile(client, imageUri3, project1.id),
metadata: {},
Expand Down

0 comments on commit 8b5dc0c

Please sign in to comment.