mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-15 23:02:18 +01:00
Don't allow library name with leading or trailing space
Windows has a specific requirement on filenames that cannot have leading or trailing spaces and the folder creation would fail. Reject such request in the api controller.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -81,6 +82,12 @@ public class LibraryStructureController : BaseJellyfinApiController
|
||||
[FromBody] AddVirtualFolderDto? libraryOptionsDto,
|
||||
[FromQuery] bool refreshLibrary = false)
|
||||
{
|
||||
// Windows does not allow files or folders with names that has leading or trailing spaces
|
||||
if (name.Length != name.Trim().Length)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
var libraryOptions = libraryOptionsDto?.LibraryOptions ?? new LibraryOptions();
|
||||
|
||||
if (paths is not null && paths.Length > 0)
|
||||
|
||||
Reference in New Issue
Block a user