server: dont use replace for file types
All checks were successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-sw Pipeline was successful
ci/woodpecker/push/test Pipeline was successful

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: 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.endsWith('/*')) {
query.andWhere('file.type like :type', { type: ps.type.replace('/*', '/') + '%' });
query.andWhere('file.type like :type', { type: ps.type.slice(0, -1) + '%' });
} else {
query.andWhere('file.type = :type', { type: ps.type });
}