Open BrianFanning opened 2 years ago
@BrianFanning I reproduced the exact error you reported while attempting to use the browse
feature to list an AWS S3 bucket. I noticed your PR #53, however when I built your branch for my s3caddy plugin and retried the request I was still unable to see the browse feature working.
And still see: http.log.error template: default_listing:5:26: executing "default_listing" at <.PageObj>: can't evaluate field PageObj in type caddys3proxy.PageObj
Were you able to get this working on your builds?
Thank you for the great implementation.
I think this is a bug in the default template. The following part seems to be wrong. https://github.com/lindenlab/caddy-s3-proxy/blob/0c6e6cdacab0d8bb2796a8cca5e65ab00b680483/browse.go#L146
The correct is: .PageObj
-> .Items
I built @BrianFanning 's branch.
And I wrote following template file and load it, browse
feature works.
<!DOCTYPE html>
<html>
<body>
<ul>
{{- range .Items }}
<li>
{{- if .IsDir}}
<a href="{{html .Url}}">{{html .Name}}</a>
{{- else}}
<a href="{{html .Url}}">{{html .Name}}</a> Size: {{html .Size}} Last Modified: {{html .LastModified}}
{{- end}}
</li>
{{- end }}
</ul>
<p>number of items: {{ .Count }}</p>
{{- if .MoreLink }}
<a href="{{ html .MoreLink }}">more...</a>
{{- end }}
</body>
</html>
This was mentioned in issue #50, but the issue was closed by the reporter. I'm having the same issue. If you are using the default BrowseTemplate, a 500 error is returned to the user. Error logs in Caddy: