Skip to content

Commit

Permalink
fix(#610): Trim traling slashes in Dockerfile directory path (otherwi…
Browse files Browse the repository at this point in the history
…se, it cuts the first character of the relative path)
  • Loading branch information
HofmeisterAn committed Nov 2, 2022
1 parent 561d522 commit d4a1e71
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- 642 Expose container port bindings automatically

### Fixed

- 610 Trim traling slashes in Dockerfile directory path (otherwise, it cuts the first character of the relative path)

## [2.2.0]

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/Testcontainers/Images/DockerfileArchive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public string Tar()
foreach (var file in GetFiles(this.dockerfileDirectory.FullName))
{
// SharpZipLib drops the root path: https://github.com/icsharpcode/SharpZipLib/pull/582.
var relativePath = file.Substring(this.dockerfileDirectory.FullName.Length + 1);
var relativePath = file.Substring(this.dockerfileDirectory.FullName.TrimEnd('/', '\\').Length + 1);

if (dockerIgnoreFile.Denies(relativePath))
{
Expand Down

0 comments on commit d4a1e71

Please sign in to comment.