You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is alternative take on the way we limit the HTML listing output.
Instead of a hard cut-off, we list up to HTMLDirListingLimit.
When a directory has more items than HTMLDirListingLimit we show
additional header and footer informing user that only $HTMLDirListingLimit
items are listed. This is a better UX.
@@ -112,7 +111,12 @@ func (i *gatewayHandler) serveDirectory(ctx context.Context, w http.ResponseWrit
112
111
// storage for directory listing
113
112
vardirListing []directoryItem
114
113
dirit:=dir.Entries()
114
+
itemCount:=0
115
115
fordirit.Next() {
116
+
itemCount++
117
+
ifitemCount>i.config.HTMLDirListingLimit {
118
+
break
119
+
}
116
120
size:="?"
117
121
ifs, err:=dirit.Node().Size(); err==nil {
118
122
// Size may not be defined/supported. Continue anyways.
@@ -136,17 +140,6 @@ func (i *gatewayHandler) serveDirectory(ctx context.Context, w http.ResponseWrit
136
140
}
137
141
dirListing=append(dirListing, di)
138
142
}
139
-
varwarnMaxDirectorySizestring
140
-
ifdirit.Err() !=nil {
141
-
select {
142
-
case<-directoryTooBig:
143
-
warnMaxDirectorySize=fmt.Sprintf("Directories bigger than %d items can't be rendered fully. Try using the CLI: ipfs ls -s --size=false --resolve-type=false %s",
0 commit comments