Skip to content

Commit

Permalink
fix: ignore PPT in zip
Browse files Browse the repository at this point in the history
It's currently unreliable and the output produces clipped images.
  • Loading branch information
aalemayhu committed Dec 12, 2024
1 parent 23f5fd6 commit ae80842
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/usecases/uploads/isZipContentFileSupported.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
isPlainText,
isCSVFile,
isPDFFile,
isPPTFile,
} from '../../lib/storage/checks';

/**
Expand All @@ -15,5 +14,4 @@ export const isZipContentFileSupported = (filename: string) =>
isMarkdownFile(filename) ??
isPlainText(filename) ??
isCSVFile(filename) ??
isPDFFile(filename) ??
isPPTFile(filename);
isPDFFile(filename);
8 changes: 7 additions & 1 deletion src/usecases/uploads/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { PrepareDeck } from '../../lib/parser/PrepareDeck';
import {
isImageFile,
isPotentialZipFile,
isPPTFile,
isZIPFile,
} from '../../lib/storage/checks';
import { getPackagesFromZip } from './getPackagesFromZip';
Expand Down Expand Up @@ -34,7 +35,11 @@ function doGenerationWork(data: GenerationData) {

const allowImageQuizHtmlToAnki =
paying && settings.imageQuizHtmlToAnki && isImageFile(filename);
if (isZipContentFileSupported(filename) || allowImageQuizHtmlToAnki) {
const isValidSingleFile =
isZipContentFileSupported(filename) ||
isPPTFile(filename) ||
allowImageQuizHtmlToAnki;
if (isValidSingleFile) {
const d = await PrepareDeck({
name: filename,
files: [{ name: filename, contents: fileContents }],
Expand All @@ -47,6 +52,7 @@ function doGenerationWork(data: GenerationData) {
packages = packages.concat(pkg);
}
} else if (
/* compressed file upload */
isZIPFile(filename) ||
isZIPFile(key) ||
isPotentialZipFile(filename) ||
Expand Down

0 comments on commit ae80842

Please sign in to comment.