test: comprehensive test suites and quality gates pass across backend, storefront and admin
Deploy Canina / deploy (push) Successful in 4m1s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 7s

- Backend (NestJS): 82 suites, 641 tests passing; 0 ESLint errors; 0 tsc errors. Hardened SSL cert/key matching, SSRF IP pinning, and eBank validation.
- Admin Panel (Vite/React): 48 suites, 300 tests passing; 0 ESLint errors; 0 tsc errors. Full coverage across all pages and settings.
- Storefront (Next.js): 62 suites, 368 tests passing; 0 ESLint errors; 0 tsc errors.
- Fixed unmount lifecycle guards, promise error handling, and component edge cases.
This commit is contained in:
devops committed 2026-10-13 16:01:00 +00:00
1 parent 1e73715169
commit ddbf1ca026
439 files changed
+32911 -6107

No files matched your search

+22 -22
View File
@@ -1,7 +1,7 @@
import { Injectable, BadRequestException } from '@nestjs/common';
import { PrismaService } from '../prisma/prisma.service';
import * as path from 'path';
import * as fs from 'fs';
import { Injectable, BadRequestException } from "@nestjs/common";
import { PrismaService } from "../prisma/prisma.service";
import * as path from "path";
import * as fs from "fs";
@Injectable()
export class MediaService {
@@ -9,14 +9,14 @@ export class MediaService {
async getAllMedia() {
const items = await this.prisma.media.findMany({
orderBy: { createdAt: 'desc' },
orderBy: { createdAt: "desc" },
});
const seenUrls = new Set<string>();
const deduplicated = [];
for (const item of items) {
const normalizedUrl = (item.url || '').trim().toLowerCase();
const normalizedUrl = (item.url || "").trim().toLowerCase();
if (normalizedUrl && seenUrls.has(normalizedUrl)) {
continue;
}
@@ -28,8 +28,8 @@ export class MediaService {
// Check if filename contains common mojibake patterns from latin1 decoding
if (cleanFilename && /[ØÙÚÛ]/.test(cleanFilename)) {
try {
const decoded = Buffer.from(cleanFilename, 'latin1').toString('utf8');
if (decoded && !decoded.includes('')) {
const decoded = Buffer.from(cleanFilename, "latin1").toString("utf8");
if (decoded && !decoded.includes("")) {
cleanFilename = decoded;
}
} catch {
@@ -48,10 +48,10 @@ export class MediaService {
async uploadFile(file: Express.Multer.File) {
if (!file) {
throw new BadRequestException('No file uploaded');
throw new BadRequestException("No file uploaded");
}
const uploadDir = path.join(process.cwd(), 'uploads');
const uploadDir = path.join(process.cwd(), "uploads");
if (!fs.existsSync(uploadDir)) {
fs.mkdirSync(uploadDir, { recursive: true });
}
@@ -59,24 +59,24 @@ export class MediaService {
// Fix Multer/Busboy ISO-8859-1 (latin1) to UTF-8 filename encoding for Persian/Arabic/Unicode characters
let originalname = file.originalname;
try {
originalname = Buffer.from(file.originalname, 'latin1').toString('utf8');
originalname = Buffer.from(file.originalname, "latin1").toString("utf8");
} catch {
originalname = file.originalname;
}
const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1e9);
const uniqueSuffix = Date.now() + "-" + Math.round(Math.random() * 1e9);
const ext = path.extname(originalname).toLowerCase();
const ALLOWED_EXTENSIONS = [
'.jpg',
'.jpeg',
'.png',
'.webp',
'.gif',
'.pdf',
".jpg",
".jpeg",
".png",
".webp",
".gif",
".pdf",
];
if (!ALLOWED_EXTENSIONS.includes(ext)) {
throw new BadRequestException(
'پسوند فایل ارسالی مجاز نیست (فرمت SVG و فایل‌های اجرایی مسدود هستند).',
"پسوند فایل ارسالی مجاز نیست (فرمت SVG و فایل‌های اجرایی مسدود هستند).",
);
}
const filename = `${uniqueSuffix}${ext}`;
@@ -101,11 +101,11 @@ export class MediaService {
async deleteMedia(id: string) {
const media = await this.prisma.media.findUnique({ where: { id } });
if (!media) throw new BadRequestException('Media not found');
if (!media) throw new BadRequestException("Media not found");
const filePath = path.join(
process.cwd(),
'uploads',
"uploads",
path.basename(media.url),
);
if (fs.existsSync(filePath)) {
@@ -124,7 +124,7 @@ export class MediaService {
for (const media of mediaItems) {
const filePath = path.join(
process.cwd(),
'uploads',
"uploads",
path.basename(media.url),
);
if (fs.existsSync(filePath)) {