Skip to content

Commit b7d2e98

Browse files
author
Andreas Kupries
committed
[#110] Fix duplication of the last path element for paths which do not have the -prefix to strip.
1 parent a0ff256 commit b7d2e98

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

convert.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,13 @@ func findFiles(dir, prefix string, recursive bool, toc *[]Asset, ignore []*regex
198198
if strings.HasPrefix(asset.Name, prefix) {
199199
asset.Name = asset.Name[len(prefix):]
200200
} else {
201-
asset.Name = filepath.Join(dir, file.Name())
201+
asset.Name = dir
202+
// Note that 'dir' already contains the full
203+
// path name (minus the basedir). Joining the
204+
// file.Name() to that generates a broken path
205+
// where the last element is duplicated,
206+
// i.e. a path like "foo/bar" becomes
207+
// "foo/bar/bar", which is a bit of a snafu ;)
202208
}
203209

204210
// If we have a leading slash, get rid of it.

0 commit comments

Comments
 (0)