UBERF-6053: Do not crash on isDerived (#4998)

* UBERF-6054: Fix delete on front

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2024-03-16 13:51:16 +07:00 committed by GitHub
parent 8ead1c4ab8
commit df09ae0b3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 7 deletions

View File

@ -289,7 +289,12 @@ export class Hierarchy {
let cl: Ref<Class<T>> | undefined = _class let cl: Ref<Class<T>> | undefined = _class
while (cl !== undefined) { while (cl !== undefined) {
if (cl === from) return true if (cl === from) return true
cl = this.getClass(cl).extends
const cll = this.classifiers.get(cl)
if (cll === undefined || this.isInterface(cll)) {
return false
}
cl = (cll as Class<T>).extends
} }
return false return false
} }

View File

@ -19,7 +19,7 @@ import { MinioService } from '@hcengineering/minio'
import { Token, decodeToken } from '@hcengineering/server-token' import { Token, decodeToken } from '@hcengineering/server-token'
import bp from 'body-parser' import bp from 'body-parser'
import cors from 'cors' import cors from 'cors'
import express, { Response } from 'express' import express, { Request, Response } from 'express'
import fileUpload, { UploadedFile } from 'express-fileupload' import fileUpload, { UploadedFile } from 'express-fileupload'
import expressStaticGzip from 'express-static-gzip' import expressStaticGzip from 'express-static-gzip'
import https from 'https' import https from 'https'
@ -314,7 +314,7 @@ export function start (
}) })
) )
async function handleHead (ctx: MeasureContext, req: any, res: Response): Promise<void> { async function handleHead (ctx: MeasureContext, req: Request, res: Response): Promise<void> {
try { try {
const token = req.query.token as string const token = req.query.token as string
const payload = decodeToken(token) const payload = decodeToken(token)
@ -370,7 +370,7 @@ export function start (
) )
}) })
const filesHandler = async (ctx: MeasureContext, req: any, res: Response): Promise<void> => { const filesHandler = async (ctx: MeasureContext, req: Request, res: Response): Promise<void> => {
try { try {
const cookies = ((req?.headers?.cookie as string) ?? '').split(';').map((it) => it.trim().split('=')) const cookies = ((req?.headers?.cookie as string) ?? '').split(';').map((it) => it.trim().split('='))
@ -487,8 +487,7 @@ export function start (
) )
}) })
// eslint-disable-next-line @typescript-eslint/no-misused-promises const handleDelete = async (req: Request, res: Response): Promise<void> => {
app.delete('/files', async (req, res) => {
try { try {
const authHeader = req.headers.authorization const authHeader = req.headers.authorization
if (authHeader === undefined) { if (authHeader === undefined) {
@ -520,7 +519,13 @@ export function start (
console.log(error) console.log(error)
res.status(500).send() res.status(500).send()
} }
}) }
// eslint-disable-next-line @typescript-eslint/no-misused-promises
app.delete('/files', handleDelete)
// eslint-disable-next-line @typescript-eslint/no-misused-promises
app.delete('/files/*', handleDelete)
// todo remove it after update all customers chrome extensions // todo remove it after update all customers chrome extensions
app.get('/import', (req, res) => { app.get('/import', (req, res) => {

View File

@ -1,3 +1,5 @@
import { Request } from 'express'
export const ETagSupport = { export const ETagSupport = {
isWeak (etag: string): boolean { isWeak (etag: string): boolean {
return etag.startsWith('W/"') return etag.startsWith('W/"')