Skip to content

Commit 4547bae

Browse files
committed
fixed lint tests
1 parent 7a94c11 commit 4547bae

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/processors/obfProcessor.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class ObfProcessor extends BaseProcessor {
105105

106106
for (const imagePath of possiblePaths) {
107107
try {
108-
const entry = this.zipFile.getEntry(imagePath);
108+
const entry = this.zipFile.getEntry(imagePath as string);
109109
if (entry) {
110110
return entry.getData(); // Return raw Buffer
111111
}
@@ -123,7 +123,7 @@ class ObfProcessor extends BaseProcessor {
123123
private extractImageAsDataUrl(imageId: string, images: any[]): string | null {
124124
// Check cache first
125125
if (this.imageCache.has(imageId)) {
126-
return this.imageCache.get(imageId)!;
126+
return this.imageCache.get(imageId) ?? null;
127127
}
128128

129129
if (!this.zipFile || !images) {
@@ -146,10 +146,12 @@ class ObfProcessor extends BaseProcessor {
146146

147147
for (const imagePath of possiblePaths) {
148148
try {
149-
const entry = this.zipFile.getEntry(imagePath);
149+
const entry = this.zipFile.getEntry(imagePath as string);
150150
if (entry) {
151151
const buffer = entry.getData();
152-
const contentType = imageData.content_type || this.getMimeTypeFromFilename(imagePath);
152+
const contentType =
153+
(imageData as { content_type?: string }).content_type ||
154+
this.getMimeTypeFromFilename(imagePath as string);
153155
const dataUrl = `data:${contentType};base64,${buffer.toString('base64')}`;
154156
this.imageCache.set(imageId, dataUrl);
155157
return dataUrl;
@@ -161,9 +163,10 @@ class ObfProcessor extends BaseProcessor {
161163
}
162164

163165
// If image has a URL, use that as fallback
164-
if (imageData.url) {
165-
this.imageCache.set(imageId, imageData.url);
166-
return imageData.url;
166+
if ((imageData as { url?: string }).url) {
167+
const url = (imageData as { url: string }).url;
168+
this.imageCache.set(imageId, url);
169+
return url;
167170
}
168171

169172
return null;

0 commit comments

Comments
 (0)