mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2026-04-03 02:43:15 +08:00
fix: 简单限制一下订阅/组合订阅的名称(不可包含 "/" )
This commit is contained in:
@@ -22,6 +22,16 @@ export default function register($app) {
|
||||
function createCollection(req, res) {
|
||||
const collection = req.body;
|
||||
$.info(`正在创建组合订阅:${collection.name}`);
|
||||
if (/\//.test(collection.name)) {
|
||||
failed(
|
||||
res,
|
||||
new RequestInvalidError(
|
||||
'INVALID_NAME',
|
||||
`Collection ${collection.name} is invalid`,
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
const allCols = $.read(COLLECTIONS_KEY);
|
||||
if (findByName(allCols, collection.name)) {
|
||||
failed(
|
||||
@@ -31,6 +41,7 @@ function createCollection(req, res) {
|
||||
`Collection ${collection.name} already exists.`,
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
allCols.push(collection);
|
||||
$.write(allCols, COLLECTIONS_KEY);
|
||||
|
||||
Reference in New Issue
Block a user