server: dont use replace for file types

No point in using replace if we already know which character we want to replace.
This commit is contained in:
Johann150 2022-12-22 14:46:21 +01:00
parent a7048f17f7
commit e2ef800708
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -45,7 +45,7 @@ export default define(meta, paramDef, async (ps, user) => {
if (ps.type) { if (ps.type) {
if (ps.type.endsWith('/*')) { if (ps.type.endsWith('/*')) {
query.andWhere('file.type like :type', { type: ps.type.replace('/*', '/') + '%' }); query.andWhere('file.type like :type', { type: ps.type.slice(0, -1) + '%' });
} else { } else {
query.andWhere('file.type = :type', { type: ps.type }); query.andWhere('file.type = :type', { type: ps.type });
} }