fix: 修复shareOwner变量作用域错误
问题:在/api/share/:code/verify接口中,shareOwner在定义前被使用 修复:将shareOwner定义移至使用之前
This commit is contained in:
@@ -1367,14 +1367,14 @@ app.post('/api/share/:code/verify', async (req, res) => {
|
|||||||
responseData.file = shareFileCache.get(code);
|
responseData.file = shareFileCache.get(code);
|
||||||
} else {
|
} else {
|
||||||
// 缓存未命中,查询存储
|
// 缓存未命中,查询存储
|
||||||
const storageType = shareOwner.current_storage_type || 'sftp';
|
|
||||||
console.log(`[缓存未命中] 分享码: ${code},存储类型: ${storageType}`);
|
|
||||||
try {
|
try {
|
||||||
// 获取分享者的用户信息
|
// 获取分享者的用户信息
|
||||||
const shareOwner = UserDB.findById(share.user_id);
|
const shareOwner = UserDB.findById(share.user_id);
|
||||||
if (!shareOwner) {
|
if (!shareOwner) {
|
||||||
throw new Error('分享者不存在');
|
throw new Error('分享者不存在');
|
||||||
}
|
}
|
||||||
|
const storageType = shareOwner.current_storage_type || 'sftp';
|
||||||
|
console.log(`[缓存未命中] 分享码: ${code},存储类型: ${storageType}`);
|
||||||
|
|
||||||
// 使用统一存储接口
|
// 使用统一存储接口
|
||||||
const { StorageInterface } = require('./storage');
|
const { StorageInterface } = require('./storage');
|
||||||
|
|||||||
Reference in New Issue
Block a user