<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - desktop LO can't insert or open Android file over MTP or PTP"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=118102">118102</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>desktop LO can't insert or open Android file over MTP or PTP
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>6.0.4.2 release
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>info@skierpage.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I connected my phone over USB and tried to insert a simple JPG image from it
into LibreOffice Writer, but got an alert with a gray lightbulb "Unknown image
format".

I quickly realized that every file operation over MTP fails, e.g.
* Insert > Image... in LibreOffice Calc displays a large dialog for a
split-second, then redisplays the Insert Image file chooser.
* File > Open... a text file silently fails in both applications.
I did limited testing of the older PTP "transfer pictures" protocol, and that
seems to fail as well.

Steps to reproduce:
1. Plug in your Android phone (mine is a Pixel 2 running Android 8.1.0) over
USB
2. Dismiss Windows' various prompts what to do with the newly-attached device.
3. Find the USB notification on the phone and change the USB connection to MTP.
On my phone it's drag windowshade to expose notifications, tap "USB for power",
change Use USB to > "Transfer files" (i.e. MTP).
4. Start LibreOffice Writer, and choose Insert > File
5. In the Insert Image dialog, navigate to an image on the phone (on my phone
an image saved in Firefox appears in This PC\Pixel 2\Internal shared
storage\Download) and click [Open]

Repeat steps 4 and 5 for other LO applications and file access.

Expected results:
>From minimal fix to best:
0. Document this limitation somewhere, e.g.
   You cannot open or insert files from a device connected over USB, such as a
phone. Neither the Media Transfer Protocol ("transfer files") nor Picture
Transfer Protocol ("transfer photos") works. Workaround: copy the file to a
local storage location and open, insert, and save the file from there.

1. Don't silently fail or show a wrong dialog such as "Unknown image format",
instead display a relevant error. Even something internal like "Vfs stat err
inode of file=0xf000 blah blah" would be better than wrong or nothing.
2. Don't even attempt to open files over unsupported protocol. Gray out the
folder or files, display "Can't open files over MTP", etc.
3. Support inserting or opening files over MTP. Other programs like Firefox,
Notepad, Paint, etc. can all open these files.

Interestingly, Notepad's titlebar shows the file as "<ORIGINAL FILENAME>[1].txt
(Read Only)" and Paint shows as "<ORIGINAL FILENAME>[1].jpg"; the [1] suggests
these programs can tell the original file path is special. Meanwhile Firefox's
location bar suggests it's working on a local copy of the file, in my case
file:///C:/Users/spage/AppData/Local/Microsoft/Windows/INetCache/IE/7NFG4Q49/<ORIGINAL
FILENAME>.ext.
FWIW I couldn't save to MTP from these applications or from LibreOffice, they
all show a Save As alert "<FILENAME>.<EXT> File not found. Check the file name
and try again."</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>