Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: req per coverage for docker #110

Merged
merged 5 commits into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion v2/dedup/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { log } from "console";
import { Request, Response, NextFunction } from "express";
const fs = require('fs');
const yaml = require('js-yaml');
Expand All @@ -14,7 +15,7 @@ export default function middleware(

// @ts-ignore
fs.access(filePath, fs.constants.F_OK, (err) => {
console.log(err ? 'File does not exist' : 'File exists');

if (err) {
// Create the file if it doesn't exist
fs.writeFileSync(filePath, '', 'utf-8');
Expand Down Expand Up @@ -56,6 +57,10 @@ export function afterMiddleware(req: Request, res: Response) {
}


if (!Array.isArray(existingData)) {
console.error('Expected an array for existingData, but got:', typeof existingData);
existingData = []; // Reset to an empty array or handle accordingly
}

// Add or update the entry for the current id
existingData.push(currentData);
Expand Down
Loading