Skip to content

Commit 625d404

Browse files
committed
mount test
1 parent 46a1df4 commit 625d404

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/MDriveSync.Client.API/Controllers/DriveController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public Result<List<JobConfig>> GetJobs()
104104
j.Metadata ??= new();
105105
j.Metadata.Message = c.ProcessMessage;
106106
j.IsMount = c.DriveIsMount();
107+
107108
return j;
108109
}).ToList();
109110
return Result.Ok(data);

src/MDriveSync.Core/Services/TimedHostedService.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,17 @@ public void DriveJobMount(string jobId)
327327

328328
if (_jobs.TryGetValue(jobId, out var job) || job != null)
329329
{
330+
if (string.IsNullOrEmpty(job.CurrrentJob?.MountConfig?.MountPoint))
331+
{
332+
throw new LogicException("请选择或输入挂载点");
333+
}
334+
335+
var pints = Filesystem.GetAvailableMountPoints().ToList();
336+
if (pints.Count > 0 && !pints.Contains(job.CurrrentJob?.MountConfig?.MountPoint))
337+
{
338+
throw new LogicException("选择的挂载点不存在或被占用,不允许挂载");
339+
}
340+
330341
job.DriveMount();
331342
}
332343
}
@@ -370,6 +381,12 @@ public void DriveMount(string driveId)
370381
throw new LogicException("请选择或输入挂载点");
371382
}
372383

384+
var pints = Filesystem.GetAvailableMountPoints().ToList();
385+
if (pints.Count > 0 && !pints.Contains(drive.MountConfig.MountPoint))
386+
{
387+
throw new LogicException("选择的挂载点不存在或被占用,不允许挂载");
388+
}
389+
373390
if (!_mounter.TryGetValue(drive.Id, out var mt) || mt == null)
374391
{
375392
mt = new AliyunDriveMounter(drive, drive.MountConfig);

0 commit comments

Comments
 (0)