Refactored a bunch of shit
All checks were successful
Docker Deploy / build-and-push (push) Successful in 3m57s
All checks were successful
Docker Deploy / build-and-push (push) Successful in 3m57s
This commit is contained in:
@@ -128,6 +128,13 @@ export const GET: APIRoute = async ({ request, locals, cookies }) => {
|
||||
"Tag",
|
||||
"Description",
|
||||
];
|
||||
const sanitizeCell = (value: string): string => {
|
||||
if (/^[=+\-@\t\r]/.test(value)) {
|
||||
return `\t${value}`;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
const rows = entries.map((e) => {
|
||||
const start = e.entry.startTime;
|
||||
const end = e.entry.endTime;
|
||||
@@ -144,10 +151,10 @@ export const GET: APIRoute = async ({ request, locals, cookies }) => {
|
||||
start.toLocaleTimeString(),
|
||||
end ? end.toLocaleTimeString() : "",
|
||||
end ? duration.toFixed(2) : "Running",
|
||||
`"${(e.user.name || "").replace(/"/g, '""')}"`,
|
||||
`"${(e.client.name || "").replace(/"/g, '""')}"`,
|
||||
`"${tagsStr.replace(/"/g, '""')}"`,
|
||||
`"${(e.entry.description || "").replace(/"/g, '""')}"`,
|
||||
`"${sanitizeCell((e.user.name || "").replace(/"/g, '""'))}"`,
|
||||
`"${sanitizeCell((e.client.name || "").replace(/"/g, '""'))}"`,
|
||||
`"${sanitizeCell(tagsStr.replace(/"/g, '""'))}"`,
|
||||
`"${sanitizeCell((e.entry.description || "").replace(/"/g, '""'))}"`,
|
||||
].join(",");
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user