mirror of
https://github.com/sakaljurgis/kodi-api-server.git
synced 2026-07-08 20:37:41 +00:00
fix file not found with space
This commit is contained in:
@@ -12,6 +12,7 @@ import { configService } from '../config/config.service';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class StaticService {
|
export class StaticService {
|
||||||
async provideDirIndex(relPath: string): Promise<Array<FileDto>> {
|
async provideDirIndex(relPath: string): Promise<Array<FileDto>> {
|
||||||
|
relPath = decodeURI(relPath);
|
||||||
if (relPath.indexOf('..') > -1) {
|
if (relPath.indexOf('..') > -1) {
|
||||||
throw new UnauthorizedException(
|
throw new UnauthorizedException(
|
||||||
'You are not authorized to visit ' + relPath,
|
'You are not authorized to visit ' + relPath,
|
||||||
@@ -23,7 +24,7 @@ export class StaticService {
|
|||||||
const stats: Stats | false = await stat(path).catch(() => false);
|
const stats: Stats | false = await stat(path).catch(() => false);
|
||||||
|
|
||||||
if (stats === false) {
|
if (stats === false) {
|
||||||
throw new NotFoundException('Path not found: ' + relPath);
|
throw new NotFoundException('Path is is not found: ' + relPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stats.isDirectory()) {
|
if (!stats.isDirectory()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user