You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "gonzoMD (via GitHub)" <gi...@apache.org> on 2024/04/03 15:58:49 UTC

[I] browser: cordova.file.applicationDirectory returns an http:// URL instead of a file:// one [cordova-plugin-file]

gonzoMD opened a new issue, #619:
URL: https://github.com/apache/cordova-plugin-file/issues/619

   # Bug Report
   
   ## Problem
   
   cordova.file.applicationDirectory returns an "http://" URL instead of a "file://" one.
   Therefore I am unable to list files inside a directory with window.resolveLocalFileSystemURL.
   
   ### What is expected to happen?
   
   cordova.file.applicationDirectory returns a "file://" URL which I can use further.
   
   ### What does actually happen?
   
   it offers an "http://" URL and window.resolveLocalFileSystemURL fails with Error 5.
   
   ![Bildschirmfoto 2024-04-03 um 17 35 09](https://github.com/apache/cordova-plugin-file/assets/17834468/aaec9d6f-61c5-4696-820d-a71e6facbdf0)
   
   
   ## Information
   
   On my Android device everything works as expected, I get a "file://" URL, which gets properly resolved
   
   
   ### Command or Code
   I use the Onsen UI framework, but this works with normal html buttons too
   ` <ons-button onclick="alert(cordova.file.applicationDirectory)">test</ons-button>`
   
   
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you experiencing the issue? -->
   
   Browser platform
   Safari 17.4.1
   
   ### Version information
   ```
   Cordova Packages:
   
       cli: 12.0.0
           common: 5.0.0
           create: 5.0.0
           lib: 12.0.1
               common: 5.0.0
               fetch: 4.0.0
               serve: 4.0.1
   
   Project Installed Platforms:
   
       android: 12.0.1
       browser: 7.0.0
   
   Project Installed Plugins:
   
       cordova-plugin-file: 8.0.1
       cordova-sqlite-evmax-build-free: 0.0.10-dev
       cordova-sqlite-storage: 6.1.0
   
   Environment:
   
       OS: macOS Sonoma 14.4.1 (23E224) (darwin 23.4.0) x64
       Node: v21.6.1
       npm: 10.2.4
   
   android Environment:
   
       android:
   [=======================================] 100% Fetch remote repository...       
   Available Android targets:
   ----------
   id: 1 or "android-33"
        Name: Android API 33, extension level 3
        Type: Platform
        API level: 33
        Revision: 3
   ----------
   id: 2 or "android-34"
        Name: Android API 34, extension level 7
        Type: Platform
        API level: 34
        Revision: 2
   
   
   Project Setting Files:
   
       config.xml:
   <?xml version='1.0' encoding='utf-8'?>
   <widget id="com.rnaumann.schwalbenshop" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
       <name>Schwalbenshop</name>
       <description>Sample Apache Cordova App</description>
       <author email="dev@cordova.apache.org" href="https://cordova.apache.org">
           Apache Cordova Team
       </author>
       <content src="index.html" />
       <allow-intent href="http://*/*" />
       <allow-intent href="https://*/*" />
        <icon src="swallow.png" />
   </widget>
   
       package.json:
   --- Start of Cordova JSON Snippet ---
   {
     "platforms": [
       "browser",
       "android"
     ],
     "plugins": {
       "cordova-sqlite-evmax-build-free": {},
       "cordova-sqlite-storage": {},
       "cordova-plugin-file": {
         "ANDROIDX_WEBKIT_VERSION": "1.4.0"
       }
     }
   }
   --- End of Cordova JSON Snippet ---
   ```
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Re: [I] browser: cordova.file.applicationDirectory returns an http:// URL instead of a file:// one [cordova-plugin-file]

Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek closed issue #619: browser: cordova.file.applicationDirectory returns an http:// URL instead of a file:// one
URL: https://github.com/apache/cordova-plugin-file/issues/619


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Re: [I] browser: cordova.file.applicationDirectory returns an http:// URL instead of a file:// one [cordova-plugin-file]

Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek commented on issue #619:
URL: https://github.com/apache/cordova-plugin-file/issues/619#issuecomment-2035103027

   I don't think this is a bug... but probably an undocumented caveat with the browser implementation.
   
   `applicationDirectory` is the directory of your app installation. On iOS/Android, this refers to the read-only directory of your unpacked application bundle. The browser has no direct equivalency of this as your "application" isn't stored locally on disk. Hence why it returns the location origin instead. There is also no HTTP api to list the contents listing your app files for the browser platform so listing browser app files is something that isn't really achievable.
   
   Conceptually, `https://localhost` (or whatever what the site address) makes the most sense for `applicationDirectory` constant on the browser platform.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org