Bug 58518 - FILEOPEN: Missing Error Message, if you Try to Insert a Picture with “Insert > File...“
Summary: FILEOPEN: Missing Error Message, if you Try to Insert a Picture with “Insert ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium normal
Assignee: Julien Nabet
URL:
Whiteboard: BSA target:7.1.0
Keywords: difficultyInteresting, needsDevEval, needsUXEval, topicDebug, topicUI
: 62100 (view as bug list)
Depends on:
Blocks: LO-File-Dialog Insert-File-Content
  Show dependency treegraph
 
Reported: 2012-12-19 14:30 UTC by Harald Koester
Modified: 2020-08-12 08:50 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harald Koester 2012-12-19 14:30:11 UTC
Problem description: 

(1) Open new text document.
(2) “Insert > File...”. A Windows dialog is openend in order to choose a file to be inserted.
(3) Choose a picture file with the file extension jpg or png. Then “OK” or “Open”. The dialog closes and nothing is inserted. Expected: Display of an error message: “The file 'filename.jpg' cannot be inserted, hence it is not a text file.” or a similar message.

Furthermore the menu item “Insert > File...” suggests that this is a general possibility in order to insert files and not only a possibility to insert text files. So, if a user expects this (insert picture), he may be quite irritated, if this is not possible. In order to avoid such an expectation, the menu item should be changed to “Text file...” or “Text document...”. Then, in the following Windows open dialog only files in text format, which can be inserted, should be displayed. This would be equal if you insert a picture from a file (Insert > Picture > From File...).

Additional Info: In Impress and Draw you can also insert a file with the same menu item. If you try to insert a picture there, you get an error message. 


              
Operating System: Windows 7
Version: 3.6.4.3 release
Comment 1 bfoman (inactive) 2013-06-20 13:03:59 UTC
Confirmed with:
LO 4.1.0.0.beta2
Build ID: 33224f4f11a05cfad2249e812fcc2975fbb61f6
Windows 7 Professional SP1 64 bit

No error message - nothing happens. Error message is present in Impress.
Comment 2 Maxim Monastirsky 2014-08-19 10:42:27 UTC
*** Bug 62100 has been marked as a duplicate of this bug. ***
Comment 3 Robinson Tryon (qubit) 2015-12-14 06:09:18 UTC Comment hidden (obsolete)
Comment 4 Björn Michaelsen 2016-01-26 18:02:40 UTC
topicDebug is a Topic.
Comment 5 Björn Michaelsen 2016-01-26 18:04:56 UTC
Remove skillDebug, superceded by topicDebug.
Comment 6 QA Administrators 2017-03-06 13:45:33 UTC Comment hidden (obsolete)
Comment 7 Harald Koester 2017-03-15 15:07:13 UTC
Bug still exists in version 5.3.0. (Win7)

Since version 4.4.0 the menu item is no longer "File..." but "Document...". This is little improvement. But it's still possible to select all kinds of files without an error message.

Bug already exists in version 3.3.0. Hence inherited from OOo.
Comment 8 QA Administrators 2018-09-23 02:49:35 UTC Comment hidden (obsolete)
Comment 9 Harald Koester 2018-09-23 13:01:52 UTC
Bug still exists with version 6.1.1 (64 bit, Win 10).

Meanwhile the menu item is "Text from File..." and no longer "Document...".
Comment 10 QA Administrators 2019-09-24 03:10:41 UTC Comment hidden (obsolete)
Comment 11 Harald Koester 2019-10-11 16:08:13 UTC
Bug still exists with version 6.3.2 (64 bit, Win 10).
Comment 12 Julien Nabet 2020-08-01 09:25:29 UTC
Xisco/Heiko: I thought about adding a warn message containing:
"File can't be converted to text"
Would it be ok?
Comment 13 Julien Nabet 2020-08-01 13:44:47 UTC
I gave a try with:
https://gerrit.libreoffice.org/c/core/+/99941
Comment 14 Heiko Tietze 2020-08-02 09:47:37 UTC
You tell the user that Insert > File > (png) cannot converted to text ("File can't be converted to text"). This sounds a bit weird to me as I wouldn't expect such function. How about something like "Only odt, doc, txt files can be inserted". And since the command is now "Insert text from file..." a simple "This is not a text document" might also work.

Btw, loading a PDF returns "Read error\nError reading file.", which is tech-talk. Either loading PDF as text is possible (and the actual reason is given why it fails) or the error message above applies as well.
Comment 15 Julien Nabet 2020-08-02 11:14:29 UTC
(In reply to Heiko Tietze from comment #14)
> You tell the user that Insert > File > (png) cannot converted to text ("File
> can't be converted to text"). This sounds a bit weird to me as I wouldn't
> expect such function. How about something like "Only odt, doc, txt files can
> be inserted". And since the command is now "Insert text from file..." a
> simple "This is not a text document" might also work.
I think "This is not a text document" would be better since the text format files may be quite long, here we could at least add "docx" but perhaps also others.

> 
> Btw, loading a PDF returns "Read error\nError reading file.", which is
> tech-talk. Either loading PDF as text is possible (and the actual reason is
> given why it fails) or the error message above applies as well.

Indeed, I'll take a look.
Comment 16 Julien Nabet 2020-08-02 11:41:09 UTC
The pdf part seems another problem.
Here's part of bt:
#6  0x00007fffef394f32 in ErrorHandler::HandleError(ErrCode, weld::Window*, DialogMask) (nErrCodeId=..., pParent=0x0, nFlags=DialogMask::MAX) at vcl/source/window/errinf.cxx:179
#7  0x00007fffde16c358 in SwView::InsertMedium(unsigned short, std::unique_ptr<SfxMedium, std::default_delete<SfxMedium> >, short) (this=0x6440070, nSlotId=5532, pMedium=std::unique_ptr<class SfxMedium> = {...}, nVersion=0) at sw/source/uibase/uiview/view2.cxx:2329
#8  0x00007fffde16ce3a in SwView::DialogClosedHdl(sfx2::FileDialogHelper*) (this=0x6440070, _pFileDlg=0x7631cc0) at sw/source/uibase/uiview/view2.cxx:2543
#9  0x00007fffde16b7e0 in SwView::LinkStubDialogClosedHdl(void*, sfx2::FileDialogHelper*) (instance=0x6440070, data=0x7631cc0) at sw/source/uibase/uiview/view2.cxx:2533
#10 0x00007ffff4985d98 in Link<sfx2::FileDialogHelper*, void>::Call(sfx2::FileDialogHelper*) const (this=0x87022a8, data=0x7631cc0) at include/tools/link.hxx:111
#11 0x00007ffff4b2bbf1 in sfx2::DocumentInserter::DialogClosedHdl(sfx2::FileDialogHelper*) (this=0x8702290) at sfx2/source/doc/docinsert.cxx:286
#12 0x00007ffff4b29fe0 in sfx2::DocumentInserter::LinkStubDialogClosedHdl(void*, sfx2::FileDialogHelper*) (instance=0x8702290, data=0x7631cc0) at sfx2/source/doc/docinsert.cxx:185
Comment 17 Commit Notification 2020-08-08 07:34:44 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ba20c2b1874cac08e93c3a122c8723868a29e456

tdf#58518: add message in case of not text file with "Insert->File" in Writer

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Julien Nabet 2020-08-08 07:35:41 UTC
Since string freeze has already be done (see https://wiki.documentfoundation.org/ReleasePlan/7.0), it can't be backported to 7.0 branch.
Comment 19 Timur 2020-08-08 09:58:19 UTC
I'm not near computer now, but shouldn't this Insert - File.. be renamed to Insert - Text File..?
Comment 20 Heiko Tietze 2020-08-12 08:50:24 UTC
(In reply to Timur from comment #19)
> I'm not near computer now, but shouldn't this Insert - File.. be renamed to
> Insert - Text File..?

It is Insert > Text from File... and IIRC we change this recently as it was just "Text" (or File?).