Skip to content

Commit 65ea3b4

Browse files
committed
Ensure that all file paths are escaped for resource ID
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
1 parent 7048a36 commit 65ea3b4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

github/resource_github_repository_file.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func resourceGithubRepositoryFileCreate(ctx context.Context, d *schema.ResourceD
242242
return diag.FromErr(err)
243243
}
244244

245-
newResourceID, err := buildID(repo, file, branch)
245+
newResourceID, err := buildID(repo, escapeIDPart(file), branch)
246246
if err != nil {
247247
return diag.FromErr(err)
248248
}
@@ -392,7 +392,7 @@ func resourceGithubRepositoryFileUpdate(ctx context.Context, d *schema.ResourceD
392392
}
393393

394394
if d.HasChanges("repository", "file", "branch") {
395-
newResourceID, err := buildID(repo, file, branch)
395+
newResourceID, err := buildID(repo, escapeIDPart(file), branch)
396396
if err != nil {
397397
return diag.FromErr(err)
398398
}
@@ -468,7 +468,7 @@ func resourceGithubRepositoryFileImport(ctx context.Context, d *schema.ResourceD
468468
return nil, err
469469
}
470470

471-
newResourceID, err := buildID(repo, filePath, branch)
471+
newResourceID, err := buildID(repo, escapeIDPart(filePath), branch)
472472
if err != nil {
473473
return nil, err
474474
}

0 commit comments

Comments
 (0)