Skip to content

Commit

Permalink
fix: upload file content
Browse files Browse the repository at this point in the history
  • Loading branch information
CallaChen111 committed Sep 27, 2024
1 parent d2552a0 commit 81ab53e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/workspace/file-upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function FileUpload() {
// Do whatever you want with the file contents
const binaryStr = reader.result;
if (binaryStr instanceof ArrayBuffer) {
const contents = Buffer.from(binaryStr).toString("ascii");
const contents = Buffer.from(binaryStr).toString("utf-8");
// @ts-expect-error
const filename = file.path!;

Expand Down
2 changes: 1 addition & 1 deletion components/workspace/upload-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function UploadModal() {
// Do whatever you want with the file contents
const binaryStr = reader.result;
if (binaryStr instanceof ArrayBuffer) {
const contents = Buffer.from(binaryStr).toString("ascii");
const contents = Buffer.from(binaryStr).toString("utf-8");
// @ts-expect-error
const filename = file.path!;

Expand Down
6 changes: 4 additions & 2 deletions data/audit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ export function useAudit(
transactionId?: string
) {
return useSWRImmutable(
auditId && transactionId ? `audit-${auditId}-${transactionId}` : undefined,
auditId && transactionId
? `audit-${auditType}-${auditId}-${transactionId}`
: undefined,
async () => {
const res = await fetch(
`${URL_CONFIG[auditType].auditContractCode}?auditId=${auditId}&transactionId=${transactionId}`
Expand Down Expand Up @@ -102,7 +104,7 @@ const auditReportSchema = z.record(

export function useAuditReport(auditType?: AuditType, auditId?: string) {
return useSWRImmutable(
auditId ? `audit-report-${auditId}` : undefined,
auditType && auditId ? `audit-report-${auditType}-${auditId}` : undefined,
async () => {
if (!auditType) return;

Expand Down

0 comments on commit 81ab53e

Please sign in to comment.