This commit is contained in:
Pim van Pelt
2025-12-03 00:17:43 +01:00
parent 45ee30fae1
commit d1db4d5e68
2 changed files with 23 additions and 23 deletions

View File

@@ -126,15 +126,15 @@ func processS3Bucket(s3Config *S3Config, opts *indexgen.Options) error {
}
entry := indexgen.FileEntry{
Name: keyName,
Path: keyName,
IsDir: false,
Size: *obj.Size,
ModTime: *obj.LastModified,
IsSymlink: false,
IconType: indexgen.GetIconType(keyName),
SizePretty: indexgen.PrettySize(*obj.Size),
ModTimeISO: obj.LastModified.Format("2006-01-02T15:04:05Z"),
Name: keyName,
Path: keyName,
IsDir: false,
Size: *obj.Size,
ModTime: *obj.LastModified,
IsSymlink: false,
IconType: indexgen.GetIconType(keyName),
SizePretty: indexgen.PrettySize(*obj.Size),
ModTimeISO: obj.LastModified.Format("2006-01-02T15:04:05Z"),
}
// Set CSS class based on file type

View File

@@ -150,28 +150,28 @@ func TestS3FlagHandling(t *testing.T) {
func TestMutualExclusionAndRequiredFlags(t *testing.T) {
tests := []struct {
name string
args []string
name string
args []string
shouldExitWithError bool
}{
{
name: "no flags provided",
args: []string{"s3-genindex"},
name: "no flags provided",
args: []string{"s3-genindex"},
shouldExitWithError: true,
},
{
name: "directory flag only",
args: []string{"s3-genindex", "-d", "/tmp"},
name: "directory flag only",
args: []string{"s3-genindex", "-d", "/tmp"},
shouldExitWithError: false,
},
{
name: "s3 flag only",
args: []string{"s3-genindex", "-s3", "http://example.com/bucket"},
name: "s3 flag only",
args: []string{"s3-genindex", "-s3", "http://example.com/bucket"},
shouldExitWithError: false,
},
{
name: "both flags provided (mutual exclusion)",
args: []string{"s3-genindex", "-d", "/tmp", "-s3", "http://example.com/bucket"},
name: "both flags provided (mutual exclusion)",
args: []string{"s3-genindex", "-d", "/tmp", "-s3", "http://example.com/bucket"},
shouldExitWithError: true,
},
}