Skip to content

Commit

Permalink
fix newline
Browse files Browse the repository at this point in the history
  • Loading branch information
rucciva committed Sep 3, 2024
1 parent 1e2be12 commit 204a6d4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func decodeFile(base fs.FS, f string) (err error) {
}
defer w.Close()

rB64 := base64.NewDecoder(base64.RawStdEncoding, r)
rB64 := base64.NewDecoder(base64.StdEncoding.WithPadding(base64.StdPadding), r)
if _, err := io.Copy(w, rB64); err != nil {
return fmt.Errorf("failed to decode file '%s' to '%s': %w", f, dec, err)
}
Expand All @@ -133,7 +133,8 @@ func encodeFile(base fs.FS, f string) (err error) {
}
defer w.Close()

wB64 := base64.NewEncoder(base64.RawStdEncoding, w)
wB64 := base64.NewEncoder(base64.StdEncoding, w)
defer wB64.Close()
if _, err := io.Copy(wB64, r); err != nil {
return fmt.Errorf("failed to decode file '%s' to '%s': %w", f, enc, err)
}
Expand Down
2 changes: 1 addition & 1 deletion testdata/a/bb/ccc/file.ext
Original file line number Diff line number Diff line change
@@ -1 +1 @@
asdoaijsdoaiushf09
asdoaijsdoaiushf09
2 changes: 1 addition & 1 deletion testdata/a/bb/ccc/file.ext.b64
Original file line number Diff line number Diff line change
@@ -1 +1 @@
YXNkb2FpanNkb2FpdXNoZjA5
YXNkb2FpanNkb2FpdXNoZjA5Cg==
2 changes: 1 addition & 1 deletion testdata/a/bb/file
Original file line number Diff line number Diff line change
@@ -1 +1 @@
asdasdasdasd
asdasdasdasd
2 changes: 1 addition & 1 deletion testdata/a/bb/file.b64
Original file line number Diff line number Diff line change
@@ -1 +1 @@
YXNkYXNkYXNkYXNk
YXNkYXNkYXNkYXNkCg==

0 comments on commit 204a6d4

Please sign in to comment.