From 0c513a604d4c417aaf2be9e6231ba8bdefb8bb59 Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Tue, 6 Sep 2022 11:26:10 +1000 Subject: [PATCH] Fix stack overflow creating windows network folders (#2886) --- internal/manager/import_file.go | 2 +- pkg/sqlite/migrations/32_postmigrate.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/manager/import_file.go b/internal/manager/import_file.go index ab2befc90..bad9d5bce 100644 --- a/internal/manager/import_file.go +++ b/internal/manager/import_file.go @@ -164,7 +164,7 @@ func (i *fileFolderImporter) FindExistingID(ctx context.Context) (*int, error) { func (i *fileFolderImporter) createFolderHierarchy(ctx context.Context, p string) (*file.Folder, error) { parentPath := filepath.Dir(p) - if parentPath == "." || parentPath == string(filepath.Separator) { + if parentPath == p { // get or create this folder return i.getOrCreateFolder(ctx, p, nil) } diff --git a/pkg/sqlite/migrations/32_postmigrate.go b/pkg/sqlite/migrations/32_postmigrate.go index bfd7dbccf..779d8f3b9 100644 --- a/pkg/sqlite/migrations/32_postmigrate.go +++ b/pkg/sqlite/migrations/32_postmigrate.go @@ -216,7 +216,7 @@ func (m *schema32Migrator) deletePlaceholderFolder(ctx context.Context) error { func (m *schema32Migrator) createFolderHierarchy(p string) (*int, sql.NullInt64, error) { parent := filepath.Dir(p) - if parent == "." || parent == string(filepath.Separator) { + if parent == p { // get or create this folder return m.getOrCreateFolder(p, nil, sql.NullInt64{}) }