df-listdirs-patch #36

Merged
af123 merged 4 commits from df/webif:df-listdirs-patch into master 2021-02-24 12:36:26 +00:00
Owner

Directories with names differing only by whitespace clash in the Browse Files list: only the first will have its size shown. Also, spaces in directory names are not shown accurately.

The server-side code generates IDs for the directory line's image and size elements. The directory size is calculated asynchronously using du and lazy-loaded by client-side JS, which therefore has to be implement a matching algorithm for the ID.

The failing algorithm just strips spaces from the directory name, which means IDs aren't guaranteed to be unique, and therefore the HTML page is non-conformant.

Instead, I chose the name mapping to be the composition of

  • JS escape() (ECMA-262 B.2.1), which guarantees its output to be a string of characters from the set of ASCII alphanumerics plus @*_+-./%, followed by
  • the URL-safe base-64 encoding (RFC 4648 section 5), which ensures that only _-. are left of the special characters.

This makes the generated ID unique and valid in HTML4.01 as well as HTML5.

The name display is improved by making any spaces into non-breaking spaces for HTML.

See https://hummy.tv/forum/threads/webif-media-browser-oddity.10104

Directories with names differing only by whitespace clash in the Browse Files list: only the first will have its size shown. Also, spaces in directory names are not shown accurately. The server-side code generates IDs for the directory line's image and size elements. The directory size is calculated asynchronously using `du` and lazy-loaded by client-side JS, which therefore has to be implement a matching algorithm for the ID. The failing algorithm just strips spaces from the directory name, which means IDs aren't guaranteed to be unique, and therefore the HTML page is non-conformant. Instead, I chose the name mapping to be the composition of * JS `escape()` (ECMA-262 B.2.1), which guarantees its output to be a string of characters from the set of ASCII alphanumerics plus `@*_+-./%`, followed by * the URL-safe base-64 encoding (RFC 4648 section 5), which ensures that only `_-.` are left of the special characters. This makes the generated ID unique and valid in HTML4.01 as well as HTML5. The name display is improved by making any spaces into non-breaking spaces for HTML. See https://hummy.tv/forum/threads/webif-media-browser-oddity.10104
df added 2 commits 2021-02-21 08:07:23 +00:00
df added 1 commit 2021-02-21 12:33:59 +00:00
df changed title from WIP:df-listdirs-patch to df-listdirs-patch 2021-02-21 19:16:33 +00:00
Author
Owner

This now seems to be working for several people and I think is ready for beta test to see if it has any undesirable (eg performance, IE8) effects.

This now seems to be working for several people and I think is ready for beta test to see if it has any undesirable (eg performance, IE8) effects.
df added 1 commit 2021-02-21 19:40:12 +00:00
af123 merged commit 3945f69c75 into master 2021-02-24 12:36:26 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hummypkg/webif#36
No description provided.