Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.mobile.android > #154342

Re: How to copy & read a huge zipped book with thousands of html & jpeg files

From Maria Sophia <mariasophia@comprehension.com>
Newsgroups comp.mobile.android, alt.os.linux, alt.comp.os.windows-10
Subject Re: How to copy & read a huge zipped book with thousands of html & jpeg files
Date 2026-07-05 10:38 -0600
Organization BWH Usenet Archive (https://usenet.blueworldhosting.com)
Message-ID <112e1ad$ed8$1@nnrp.usenet.blueworldhosting.com> (permalink)
References <112c25r$2gt7$1@nnrp.usenet.blueworldhosting.com> <112cbas$1p57$1@nnrp.usenet.blueworldhosting.com> <112cd5q$9e5$1@nnrp.usenet.blueworldhosting.com> <naufojFbt7iU1@mid.individual.net>

Cross-posted to 3 groups.

Show all headers | View raw


Andy Burns wrote:
>> Maria Sophia wrote:
>>>  Data =
>>> content://com.android.externalstorage.documents/document/pages/2.html
>>> Yikes. What's happening? This isn't a real file-system path at all.
>>> It's an SAF document URI.
>> 
>> The index.html is written using normal standard relative links such as
>>  pages/2.html
>>  images/foo.png
>>  css/style.css
>> 
>> These only work if the browser knows the real directory.
>> But the fashuganeh Android SAF apparently hides the directory.
>> 
>> Therefore, SAF URIs cannot be used for relative links inside HTML files.
>> So when the HTML says:  <a href="pages/2.html">
>> Android tries to resolve it relative to the SAF URI, not the filesystem.
>> 
>> Worse, when I tap an HTML file in ZArchiver, it passes the file using
>>  content://ru.zdevs.zarchiver.external/...	
>> Which is ZArchiver's own SAF wrapper, not a real path.
>> 
>> When I paste the full URI into Privacy Browser, I get the error
>>  Webpage not available. 
>>  The webpage at file:///storage/emulated/0/0000/book/name/index.html
>>  could not be loaded because: net::ERR_ACCESS_DENIED
>> 
>> The normal HTML manual expects a real filesystem:	   
>>  /storage/emulated/0/0000/book/name/index.html
>>  /storage/emulated/0/0000/book/name/pages/2.html
>> But Android 16 rewrites everything into SAF URIs:
>>  content://com.android.externalstorage.documents/document/primary%3A0000%2Fbook%2Fname%2Findex.html	 
>> 
>> This means the relative link
>>  pages/2.html
>> Becomes 
>>  content://com.android.externalstorage.documents/document/pages/2.html
>> which is not a real path. It's a virtual document reference.
>> 
>> So why did file:///storage/emulated/0/0000/book/name/index.html fail?
>> Android 10+ treats any custom top-level folder as restricted.
>> 
>> Apparently, Android only allows browsers to read:
>>  /storage/emulated/0/Download/
>>  /storage/emulated/0/Documents/
>>  /storage/emulated/0/DCIM/
>>  /storage/emulated/0/Pictures/	 
>> 
>> Apparently, Occam's Razor says the simplest explanation that fits the facts  
>> is that Android 16 blocks browsers from reading custom top-level folders.
> 
> I remember that issue (we were replicating hundreds of safety documents 
> down to a fire engine, but then android didn't like opening shortcuts as 
> file:// URLs
> 
> The answer in our case was to install a web server and open them as
> http://localhost URLs

Hi Andy,

THANK YOU for confirming the diagnosis and agreeing with the workaround.

Having always dealt with huge HTML references on the desktop, I was wholly
unprepared for the shock that Android 10+ is no longer POSIX compliant.

In terms of WebView, Android 10+ is apparently only POXIX compliant in
  a. /storage/emulated/0/Download/
  b. /storage/emulated/0/Documents/
  c. /storage/emulated/0/DCIM/
  d. /storage/emulated/0/Pictures/

I "could" have solved the problem by putting the repair manual in one of 
those directories, but they're thoroughly polluted much like similar 
directories are on Windows, so my linux-learned rule is to use /usr/local 
instead (e.g., on Windows it's c:\data & on Android it's /0000 or /0001).

Android 10+ was trying to force me away from putting everything I care 
about into a single top-level folder on each sdcard (/0000 or /0001).

But that makes backup and recovery more complicated since then I would have 
to remember where Android forced me to put stuff, and worse, I'd have to 
maintain those Android hierarchies in a clean way when you know that any 
directory that is considered "public" on Windows or Android is polluted 
beyond belief. So we'd be maintaining and cleaning those folders forever.

I like POSIX.
Hence, I hate SAF.

Reassuringly, your experience stated above matches exactly what I ran into. 

The underlying problem seems to be that Android 10+ no longer exposes real 
POSIX filesystem paths to WebView-based browsers outside of the four 
"public" SAF-sanctioned directories (Download, Documents, DCIM, Pictures)/

As of Android 10+, apparently anywhere other than those four highly 
polluted folders is treated as a restricted namespace to WebView clients.

When an HTML file is opened from a custom top-level directory such as:
 /storage/emulated/0/0000/book/name/index.html
Android does NOT hand the browser the actual POSIX path. Instead, it 
rewrites the path into a Storage Access Framework (SAF) content URI.

content://com.android.externalstorage.documents/document/primary%3A0000%2Fbook%2Fname%2Findex.html
But this is not a real directory. It is a virtual document handle. 

What you & I both found out was that because the browser never receives the
true filesystem location, all relative links inside the manual break. 

A link like:
 pages/2.html
gets resolved relative to the SAF URI, producing:
 content://com.android.externalstorage.documents/document/pages/2.html
which does not correspond to any real file on disk. 

As a result, our first indication of the problem is that WebView then
throws ERR_ACCESS_DENIED or ERR_FILE_NOT_FOUND because it cannot traverse
the directory tree. The browser is effectively sandboxed inside a synthetic
document namespace with no ability to follow POSIX-style relative paths.

This is why unzipping the manual worked fine, but opening index.html fails
in every browser tested. Yet, it worked perfectly on Windows (& Linux).

So I knew there was nothing wrong with the document's contents, per se.

The HTML book expects a normal Unix-style directory hierarchy, so I was
confused until it dawned upon me belatedly that Android's new SAF layer
hides that hierarchy behind virtual URIs (much as iOS does to everything).

While I started off trying to find an ancient browser that would respect
POSIX paths, it turned out that both our solutions seem to be apropos.

I'm embarrassed to say that it took me over an hour or two to figure out
that the solution was to bypass WebView's file:// restrictions entirely by
serving the manual over HTTP. 

Had I known what you already knew, it wouldn't have taken me a couple of
hours to figure out what hte problem was and what a likely solution is.

That's one of the beauties of Usenet, by the way, in that now everyone
reading this will save the couple of hours it took for me to understand the
problem and to implement a solution. 
(BTW, I'm curious how long it took your team to figure this one out too!)

With the solution your team and I came up with, HTTP requests do not go
through SAF, so the browser can finally see the real directory structure.

I had no idea what the best server would be, so my implementation was to 
grant Termux full filesystem access, and then start a local web server:
 $ pkg install python
 $ cd /storage/emulated/0/0000/book/name
 $ python3 -m http.server 8000

This sets the $DOCUMENT_ROOT, so that on any web browser, I opened:
 <http://localhost:8000>

At that point everything worked perfectly. All relative links, images, CSS,
and subpages loaded exactly as intended because the browser was now talking
to a real POSIX-backed directory via HTTP instead of a SAF virtual document
tree.

In short, the summary for everyone else to benefit from, that you and I
learned the hard way, is that Android 10+ broke POSIX direct file:// access
for custom top-level directories, but, a workaround is a localhost HTTP
server restores normal Unix semantics. Linux to the rescue, once again.

Thanks again for confirming the approach I ended up with last night.
Had I waited a day, I would have solved it today with your kind advice!

May I ask how long it took you and your team to arrive at that conclusion
and more importantly, what server mechanism you employed, if it's a free ad
free easily available web server, because the Termux method has issues too.
-- 
Usenet allows kind intelligent good-hearted people to help each other out.

Back to comp.mobile.android | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-04 18:40 -0400
  Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-04 21:17 -0400
    Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-04 21:48 -0400
      Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-04 22:51 -0400
        Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-04 23:57 -0400
          Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-04 23:13 -0600
            Re: How to copy & read a huge zipped book with thousands of html & jpeg files Nuno Silva <nunojsilva@invalid.invalid> - 2026-07-08 10:10 +0100
              Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-08 10:32 -0400
          Re: How to copy & read a huge zipped book with thousands of html & jpeg files "Carlos E. R." <robin_listas@es.invalid> - 2026-07-05 13:29 +0200
            Re: How to copy & read a huge zipped book with thousands of html & jpeg files Dave Royal <dave@dave123royal.com> - 2026-07-05 14:48 +0100
              Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-05 10:06 -0600
              Re: How to copy & read a huge zipped book with thousands of html & jpeg files "Carlos E. R." <robin_listas@es.invalid> - 2026-07-05 19:10 +0200
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files Computer Nerd Kev <not@telling.you.invalid> - 2026-07-05 17:37 +0000
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files Alan <nuh-uh@nope.com> - 2026-07-07 11:11 -0700
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files Dave Royal <dave@dave123royal.com> - 2026-07-05 21:00 +0100
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files "Carlos E. R." <robin_listas@es.invalid> - 2026-07-05 22:50 +0200
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-05 23:06 -0600
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files "Carlos E. R." <robin_listas@es.invalid> - 2026-07-06 12:05 +0200
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files "Carlos E. R." <robin_listas@es.invalid> - 2026-07-06 12:24 +0200
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-06 10:28 -0600
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files "Carlos E. R." <robin_listas@es.invalid> - 2026-07-06 19:50 +0200
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-06 09:36 -0600
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files "Carlos E. R." <robin_listas@es.invalid> - 2026-07-06 19:56 +0200
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-08 11:14 -0400
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files Dave Royal <dave@dave123royal.com> - 2026-07-06 07:58 +0100
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files "Carlos E. R." <robin_listas@es.invalid> - 2026-07-06 12:12 +0200
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-05 15:12 -0600
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files Chris <ithinkiam@gmail.com> - 2026-07-08 17:51 +0000
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files "Carlos E. R." <robin_listas@es.invalid> - 2026-07-08 21:49 +0200
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files Chris <ithinkiam@gmail.com> - 2026-07-09 07:05 +0000
              Re: How to copy & read a huge zipped book with thousands of html & jpeg files Chris <ithinkiam@gmail.com> - 2026-07-08 17:44 +0000
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files Dave Royal <dave@dave123royal.com> - 2026-07-09 06:09 +0100
            Re: How to copy & read a huge zipped book with thousands of html & jpeg files Nuno Silva <nunojsilva@invalid.invalid> - 2026-07-08 10:39 +0100
          Re: How to copy & read a huge zipped book with thousands of html & jpeg files Nuno Silva <nunojsilva@invalid.invalid> - 2026-07-08 10:37 +0100
        Re: How to copy & read a huge zipped book with thousands of html & jpeg files Arno Welzel <usenet@arnowelzel.de> - 2026-07-06 17:53 +0200
          Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-06 10:47 -0600
          Re: How to copy & read a huge zipped book with thousands of html & jpeg files Nuno Silva <nunojsilva@invalid.invalid> - 2026-07-08 10:57 +0100
      Re: How to copy & read a huge zipped book with thousands of html & jpeg files Andy Burns <usenet@andyburns.uk> - 2026-07-05 08:35 +0100
        Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-05 10:38 -0600
          Re: How to copy & read a huge zipped book with thousands of html & jpeg files Andy Burns <usenet@andyburns.uk> - 2026-07-05 18:22 +0100
            Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-05 12:16 -0600
          Re: How to copy & read a huge zipped book with thousands of html & jpeg files "Carlos E. R." <robin_listas@es.invalid> - 2026-07-05 19:41 +0200
            Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-05 12:54 -0600
              Re: How to copy & read a huge zipped book with thousands of html & jpeg files "Carlos E. R." <robin_listas@es.invalid> - 2026-07-05 23:11 +0200
                Re: How to copy & read a huge zipped book with thousands of html & jpeg files Maria Sophia <mariasophia@comprehension.com> - 2026-07-05 15:23 -0600
  Re: How to copy & read a huge zipped book with thousands of html & jpeg files Arno Welzel <usenet@arnowelzel.de> - 2026-07-06 17:48 +0200

csiph-web