mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-06 00:03:38 +00:00
Check the length of 'file' before checking if it ends with '/'
This commit is contained in:
@@ -448,7 +448,7 @@ func (manager *SnapshotManager) CleanSnapshotCache(latestSnapshot *Snapshot, all
|
||||
|
||||
allFiles, _ := manager.ListAllFiles(manager.snapshotCache, chunkDir)
|
||||
for _, file := range allFiles {
|
||||
if file[len(file)-1] != '/' {
|
||||
if len(file) > 0 && file[len(file)-1] != '/' {
|
||||
chunkID := strings.Replace(file, "/", "", -1)
|
||||
if _, found := chunks[chunkID]; !found {
|
||||
LOG_DEBUG("SNAPSHOT_CLEAN", "Delete chunk %s from the snapshot cache", chunkID)
|
||||
@@ -2428,7 +2428,7 @@ func (manager *SnapshotManager) pruneSnapshotsExhaustive(referencedFossils map[s
|
||||
|
||||
allFiles, _ := manager.ListAllFiles(manager.storage, chunkDir)
|
||||
for _, file := range allFiles {
|
||||
if file[len(file)-1] == '/' {
|
||||
if len(file) == 0 || file[len(file)-1] == '/' {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user