laurent22 / joplin

Joplin - the secure note taking and to-do app with synchronisation capabilities for Windows, macOS, Linux, Android and iOS.
https://joplinapp.org
Other
44.81k stars 4.87k forks source link

Joplin saves resources with absolute Windows Paths causing broken synced notes and .jex file is missing images #6211

Closed gerroon closed 1 year ago

gerroon commented 2 years ago

To replicate:

https://github.com/laurent22/joplin/issues/6211#issuecomment-1154139345


Hi

For some reason some images in some of the notes were not synching to other devices. I tried to figure out what the issue was but I can't pinpoint. After even more digging I found that Joplin records absolute Windows paths to the resources which ends up breaking image loading on other devices. Obviously this does not happen always and I do not know when or how Joplin decides to behave this way.

Please see the bottom of the .md content I pasted below. I renamed my user to USER


![5c72282b15413a87eb6bc17ff130689d.png](file:///C:/Users/USER/.config/joplin-desktop/resources/fad7b55125dd4500ad16c331911d0399.png)

<img src="file:///C:/Users/USER/.config/joplin-desktop/resources/1ee8144b5c6f4c32b431c869decb387c.png" alt="2fcdb0291570e35fbe09e433ad564eb3.png" width="1647" height="2687" class="jop-noMdConv">

.jex file ( You can see that those images are not recorded in the resources folder)

Human head - Wikipedia 2.zip

I exported one of the notes I found with that issue, and as you can see the resource has absolute path, this is not something I added myself. This page was captured by the Chrome extension.

This is the page I captured, but I do not know if this is really a Clipper issue since the clipper would not know where the images are saved on the drive.

https://en.wikipedia.org/w/index.php?title=Human_head

As a result of this issue the exported .jex files also does not contain those images which has broken image icons, same with syncing to the other devices where those images are also going to be broken on those devices.

Environment

Joplin version: 2.7.13 Platform: Windows 10

  1. Select the page and capture the selection while the visual editor is enabled on Windows
  2. Sync to other devices
# Human head

| Human head |     |
| --- | --- |
| [![Proportions of the Head.jpg](../_resources/250px-Proportions_of_the_Head_48cce60f7c324af986fb.jpg)](https://en.wikipedia.org/wiki/File:Proportions_of_the_Head.jpg)<br>The [human](https://en.wikipedia.org/wiki/Human "Human") head drawn by [Leonardo da Vinci](https://en.wikipedia.org/wiki/Leonardo_da_Vinci "Leonardo da Vinci") |     |
| Details |     |
| Identifiers |     |
| [Latin](https://en.wikipedia.org/wiki/Latin "Latin") | *caput* |
| [MeSH](https://en.wikipedia.org/wiki/Medical_Subject_Headings "Medical Subject Headings") | [D006257](https://meshb.nlm.nih.gov/record/ui?ui=D006257) |
| [TA98](https://en.wikipedia.org/wiki/Terminologia_Anatomica "Terminologia Anatomica") | [A01.1.00.001](http://www.unifr.ch/ifaa/Public/EntryPage/TA98%20Tree/Entity%20TA98%20EN/01.1.00.001%20Entity%20TA98%20EN.htm) |
| [TA2](https://en.wikipedia.org/wiki/Terminologia_Anatomica "Terminologia Anatomica") | [98](https://ta2viewer.openanatomy.org/?id=98) |
| [FMA](https://en.wikipedia.org/wiki/Foundational_Model_of_Anatomy "Foundational Model of Anatomy") | [7154](https://bioportal.bioontology.org/ontologies/FMA/?p=classes&conceptid=http%3A%2F%2Fpurl.org%2Fsig%2Font%2Ffma%2Ffma7154) |
| ***[Anatomical terminology](https://en.wikipedia.org/wiki/Anatomical_terminology "Anatomical terminology")***<br>\[[edit on Wikidata](https://www.wikidata.org/wiki/Q3409626 "d:Q3409626")\] |     |

In human anatomy, the **head** is at the top of the [human body](https://en.wikipedia.org/wiki/Human_body "Human body"). It supports the [face](https://en.wikipedia.org/wiki/Face "Face") and is maintained by the [skull](https://en.wikipedia.org/wiki/Human_skull "Human skull"), which itself encloses the [brain](https://en.wikipedia.org/wiki/Human_brain "Human brain").

## Contents

- [1 Structure](#Structure)
    - [1.1 Blood supply](#Blood_supply)
    - [1.2 Nerve supply](#Nerve_supply)
- [2 Function](#Function)
- [3 Society and culture](#Society_and_culture)
    - [3.1 Clothing](#Clothing)
    - [3.2 Anthropometry](#Anthropometry)
        - [3.2.1 Average head sizes](#Average_head_sizes)
- [4 See also](#See_also)
- [5 References](#References)
- [6 Further reading](#Further_reading)

## [](#)Structure

[![](../_resources/220px-Head_ap_anatomy_d4e750f526004c0d8efdb42bbfca.jpg)](https://en.wikipedia.org/wiki/File:Head_ap_anatomy.jpg)

Anatomy of the human head

The human head consists of a fleshy outer portion, which surrounds the bony [skull](https://en.wikipedia.org/wiki/Human_skull "Human skull"). The [brain](https://en.wikipedia.org/wiki/Brain "Brain") is enclosed within the skull. There are 22 bones in the human head. The head rests on the [neck](https://en.wikipedia.org/wiki/Neck "Neck"), and the seven [cervical vertebrae](https://en.wikipedia.org/wiki/Cervical_vertebrae "Cervical vertebrae") support it. The human head typically weighs between 2.3 and 5 kilograms (5.1 and 11.0 lb)

The face is the [anterior](https://en.wikipedia.org/wiki/Anterior "Anterior") part of the head, containing the [eyes](https://en.wikipedia.org/wiki/Eyes "Eyes"), [nose](https://en.wikipedia.org/wiki/Nose "Nose"), and [mouth](https://en.wikipedia.org/wiki/Mouth "Mouth"). On either side of the mouth, the [cheeks](https://en.wikipedia.org/wiki/Cheek "Cheek") provide a fleshy border to the [oral cavity](https://en.wikipedia.org/wiki/Oral_cavity "Oral cavity"). The ears sit to either side of the head.

### [](#)Blood supply

The head receives blood supply through the internal and external [carotid arteries](https://en.wikipedia.org/wiki/Carotid_artery "Carotid artery"). These supply the area outside of the skull ([external carotid artery](https://en.wikipedia.org/wiki/External_carotid_artery "External carotid artery")) and inside of the skull ([internal carotid artery](https://en.wikipedia.org/wiki/Internal_carotid_artery "Internal carotid artery")). The area inside the skull also receives blood supply from the [vertebral arteries](https://en.wikipedia.org/wiki/Vertebral_artery "Vertebral artery"), which travel up through the cervical vertebrae.

### [](#)Nerve supply

[![](../_resources/350px-Gray784_313b8e9ade75475fa24b80b8d1e5977a.png)](https://en.wikipedia.org/wiki/File:Gray784.png)

Sensory areas of the head, showing the general distribution of the three divisions of the fifth nerve. From Gray’s Anatomy 1918

The twelve pairs of [cranial nerves](https://en.wikipedia.org/wiki/Cranial_nerve "Cranial nerve") provide the majority of nervous control to the head. The sensation to the face is provided by the branches of the [trigeminal nerve](https://en.wikipedia.org/wiki/Trigeminal_nerve "Trigeminal nerve"), the fifth [cranial nerve](https://en.wikipedia.org/wiki/Cranial_nerve "Cranial nerve"). Sensation to other portions of the head is provided by the [cervical nerves](https://en.wikipedia.org/wiki/Cervical_nerve "Cervical nerve").

Modern texts are in agreement about which areas of the skin are served by which nerves, but there are minor variations in some of the details. The borders designated by diagrams in the 1918 edition of [Gray’s Anatomy](https://en.wikipedia.org/wiki/Gray%27s_Anatomy "Gray's Anatomy") are similar but not identical to those generally accepted today.

The cutaneous innervation of the head is as follows:

- [Ophthalmic nerve](https://en.wikipedia.org/wiki/Ophthalmic_nerve "Ophthalmic nerve") (green)
- [Maxillary nerve](https://en.wikipedia.org/wiki/Maxillary_nerve "Maxillary nerve") (pink)
- [Mandibular nerve](https://en.wikipedia.org/wiki/Mandibular_nerve "Mandibular nerve") (yellow)
- [Cervical plexus](https://en.wikipedia.org/wiki/Cervical_plexus "Cervical plexus") (purple)
- [Dorsal rami](https://en.wikipedia.org/wiki/Dorsal_ramus_of_spinal_nerve "Dorsal ramus of spinal nerve") of [cervical nerves](https://en.wikipedia.org/wiki/Cervical_nerves "Cervical nerves") (blue) and others are in picture which show following in upper column

## [](#)Function

|     |     |
| --- | --- |
| [![\[icon\]](../_resources/20px-Wiki_letter_w_cropped.svg_e222b695cf4a4001ba7.png)](https://en.wikipedia.org/wiki/File:Wiki_letter_w_cropped.svg) | This section **needs expansion**. You can help by [adding to it](https://en.wikipedia.org/w/index.php?title=Human_head&action=edit&section=). *(March 2014)* |

The head contains [sensory organs](https://en.wikipedia.org/wiki/Sensory_organ "Sensory organ"): two eyes, two ears, a nose and [tongue](https://en.wikipedia.org/wiki/Tongue "Tongue") inside of the mouth. It also houses the [brain](https://en.wikipedia.org/wiki/Brain "Brain"). Together, these organs function as a processing center for the body by relaying sensory information to the brain. Humans can process information faster by having this central nerve cluster.

## [](#)Society and culture

For [humans](https://en.wikipedia.org/wiki/Human "Human"), the front of the head (the face) is the main distinguishing feature between different people due to its easily discernible features, such as eye and hair colors, shapes of the sensory organs, and the wrinkles. Humans easily differentiate between faces because of the brain’s predisposition toward facial recognition. When observing a relatively unfamiliar species, all faces seem nearly identical. Human infants are biologically programmed to recognize subtle differences in anthropomorphic facial features.<sup>[\[1\]](#cite_note-1)</sup>

[![](../_resources/220px-COLLECTIE_TROPENMUSEUM_Een_510111e15f12488c9.jpg)](https://en.wikipedia.org/wiki/File:COLLECTIE_TROPENMUSEUM_Een_Ibu_Dajak_krijger_uit_Long_Nawan_Z._en_O._afdeling_Borneo._TMnr_60034031.jpg)

[Dayak people](https://en.wikipedia.org/wiki/Dayak_people "Dayak people") were feared for their headhunting practices

People who have greater than average intelligence are sometimes depicted in cartoons as having bigger heads as a way of notionally indicating that they have a “larger brain”. Additionally, in [science fiction](https://en.wikipedia.org/wiki/Science_fiction "Science fiction"), an [extraterrestrial](https://en.wikipedia.org/wiki/Extraterrestrial_life_in_popular_culture "Extraterrestrial life in popular culture") having a big head is often symbolic of high intelligence. Despite this depiction, advances in [neurobiology](https://en.wikipedia.org/wiki/Neurobiology "Neurobiology") have shown that the functional diversity of the brain means that a difference in overall brain size is only slightly to moderately correlated to differences in overall intelligence between two humans.<sup>[\[2\]](#cite_note-2)</sup>

The head is a source for many metaphors and [metonymies](https://en.wikipedia.org/wiki/Metonymy "Metonymy") in [human language](https://en.wikipedia.org/wiki/Human_language "Human language"), including referring to things typically near the human head ( “the head of the bed”), things physically similar to the way a head is arranged spatially to a body (“the head of the table”), metaphorically (“the head of the class”), and things that represent some characteristics associated with the head, such as intelligence (“there are a lot of good heads in this company”).<sup>[\[3\]](#cite_note-3)</sup>

Ancient Greeks had a method for evaluating [sexual attractiveness](https://en.wikipedia.org/wiki/Sexual_attractiveness "Sexual attractiveness") based on the [Golden ratio](https://en.wikipedia.org/wiki/Golden_ratio "Golden ratio"), part of which included measurements of the head.<sup>[\[4\]](#cite_note-4)</sup>

[Headhunting](https://en.wikipedia.org/wiki/Headhunting "Headhunting") is the practice of taking and [preserving a person’s head](https://en.wikipedia.org/wiki/Human_trophy_collecting "Human trophy collecting") after killing the person. Headhunting has been practiced across the Americas, Europe, Asia, and Oceania for millennia.<sup>[\[5\]](#cite_note-5)</sup>

### [](#)Clothing

[![](../_resources/170px-0004_Madagascar_(555870032_d82430257b3b43b8a.jpg)](https://en.wikipedia.org/wiki/File:0004_Madagascar_%285558700320%29.jpg)

A man wearing a [straw hat](https://en.wikipedia.org/wiki/Straw_hat "Straw hat")

Main article: [Headgear](https://en.wikipedia.org/wiki/Headgear "Headgear")

Headpieces can signify status, origin, religious/spiritual beliefs, social grouping, team affiliation, occupation, or fashion choices.

In many cultures, covering the head is seen as a sign of respect. Often, some or all of the head must be covered and veiled when entering holy places or places of prayer. For many centuries, women in Europe, the [Middle East](https://en.wikipedia.org/wiki/Middle_East "Middle East"), and [South Asia](https://en.wikipedia.org/wiki/South_Asia "South Asia") have covered their head hair as a sign of modesty. This trend has changed drastically in Europe in the 20th century, although is still observed in other parts of the world. In addition, a number of religions require men to wear specific head clothing—such as the [Islamic](https://en.wikipedia.org/wiki/Islamic "Islamic") [Taqiyah (cap)](https://en.wikipedia.org/wiki/Taqiyah_%28cap%29 "Taqiyah (cap)"), [Jewish](https://en.wikipedia.org/wiki/Jewish "Jewish") [yarmulke](https://en.wikipedia.org/wiki/Yarmulke "Yarmulke"), or the [Sikh turban](https://en.wikipedia.org/wiki/Sikh_turban "Sikh turban"). The same goes for women with the [Muslim](https://en.wikipedia.org/wiki/Muslim "Muslim") [hijab](https://en.wikipedia.org/wiki/Hijab "Hijab") or [Christian](https://en.wikipedia.org/wiki/Christians "Christians") nun’s [habit](https://en.wikipedia.org/wiki/Religious_habit "Religious habit").

A [hat](https://en.wikipedia.org/wiki/Hat "Hat") is a head covering that can serve a variety of purposes. Hats may be worn as part of a uniform or used as a protective device, such as a [hard hat](https://en.wikipedia.org/wiki/Hard_hat "Hard hat"), a covering for warmth, or a fashion accessory. Hats can also be indicative of social status in some areas of the world.

### [](#)[Anthropometry](https://en.wikipedia.org/wiki/Anthropometry "Anthropometry")

While numerous charts detailing head sizes in infants and children exist, most do not measure average head circumference past the age of 21. Reference charts for adult head circumference also generally feature [homogeneous](https://en.wikipedia.org/wiki/Homogeneous "Homogeneous") samples and fail to take height and weight into account.<sup>[\[6\]](#cite_note-6)</sup>

One study in the United States estimated the average human head circumference to be 57 centimetres (22+1⁄2 in) in males and 55 centimetres (21+3⁄4 in) in females.<sup>[\[7\]](#cite_note-7)</sup><sup>\[*[dubious](https://en.wikipedia.org/wiki/Wikipedia:Accuracy_dispute#Disputed_statement "Wikipedia:Accuracy dispute") – [discuss](https://en.wikipedia.org/wiki/Talk:Human_head#Talk_Average_Head_Circumference_Statement "Talk:Human head")*\]</sup> A British study by [Newcastle University](https://en.wikipedia.org/wiki/Newcastle_University "Newcastle University") showed an average size of 57.2 cm for males and 55.2 cm for females with average size varying proportionally with height <sup>[\[8\]](#cite_note-8)</sup>

[Macrocephaly](https://en.wikipedia.org/wiki/Macrocephaly "Macrocephaly") can be an indicator of increased risk for some types of cancer in individuals who carry the genetic mutation that causes [Cowden syndrome](https://en.wikipedia.org/wiki/Cowden_syndrome "Cowden syndrome"). For adults, this refers to head sizes greater than 58 centimeters in men or greater than 57 centimeters in women.<sup>[\[9\]](#cite_note-9)</sup><sup>[\[10\]](#cite_note-10)</sup>

#### [](#)Average head sizes

![5c72282b15413a87eb6bc17ff130689d.png](file:///C:/Users/USER/.config/joplin-desktop/resources/fad7b55125dd4500ad16c331911d0399.png)

<img src="file:///C:/Users/USER/.config/joplin-desktop/resources/1ee8144b5c6f4c32b431c869decb387c.png" alt="2fcdb0291570e35fbe09e433ad564eb3.png" width="1647" height="2687" class="jop-noMdConv">
gerroon commented 2 years ago

I think I also have another plausible explanation

Joplin records full paths to resources if you copy an image from a note and paste to another one

github-actions[bot] commented 2 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

gerroon commented 2 years ago

I provided all the info already

github-actions[bot] commented 2 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

gerroon commented 2 years ago

This is is not fixed and it is a major bug.

github-actions[bot] commented 2 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

gerroon commented 2 years ago

It is not fixed and still a big bug

5chi-3cun-4fen commented 2 years ago

It happened to me lately. https://github.com/laurent22/joplin/issues/6570 Same problem. I agree with you. I also found out that joplin on windows is using absolute path to images.

5chi-3cun-4fen commented 2 years ago

This is still a severe bug and is not fixed...

5chi-3cun-4fen commented 2 years ago

https://discourse.joplinapp.org/t/why-is-github-issues-long-left-to-be-answered/25993/8

seems like the bug is not easily reproduce. I found a way to avoid it. Paste the images into the markdown editor

laurent22 commented 2 years ago

If anyone is having this issue, please could you provide the exact steps to follow to replicate it? Also please provide your operating system and Joplin version number.

tomasz1986 commented 2 years ago

Copy and paste from the forum.

I can reproduce following the instructions/clues from the GitHub issue.

  1. Create a new note and attach an image to it.
  2. Copy the image with Ctrl+C using the WYSIWYG mode.
  3. Create yet another note and paste the image with Ctrl+V using the Markdown mode.

Joplin v2.8.8 under Windows 10.

Joplin 2.8.8 (prod, win32)

Client ID: 8cafef60dc99413dbaf031791993c722
Sync Version: 3
Profile Version: 41
Keychain Supported: Yes

Revision: c2a6a13
laurent22 commented 2 years ago

@tomasz1986, I can indeed replicate this, but I don't think that's the problem they have, and it's probably not that common to copy from Rich Text editor to Markdown one. It seems to be some issue with Windows paths, but I'd need to try on Windows to replicate

gerroon commented 2 years ago

This becomes an issue when the user tries different clients on different platforms or shares between different users of Joplin or users of the system the paths change.

SFulpius commented 2 years ago

@gerroon Do you have some non-ASCII characters in your Windows username ? If it is the case, I may have found your bug.

Steps to reproduce:

  1. The Joplin resource directory path must contain some non-ASCII characters.
  2. Create a new note.
  3. Using the markdown editor, attach an image to the note.
  4. Switch to the WYSIWYG editor and make some changes to the note (e.g. add some text below the image)
  5. Switch back to markdown. The link to the image is now the full windows path (C:/ ...)

I have written a fix for this bug. I will make a PR and link your issue if you confirm that it is your bug.

gerroon commented 2 years ago

@gerroon Do you have some non-ASCII characters in your Windows username ? If it is the case, I may have found your bug.

Steps to reproduce:

1. The Joplin resource directory path must contain some non-ASCII characters.

2. Create a new note.

3. Using the markdown editor, attach an image to the note.

4. Switch to the WYSIWYG editor and make some changes to the note (e.g. add some text below the image)

5. Switch back to markdown. The link to the image is now the full windows path (C:/ ...)

I have written a fix for this bug. I will make a PR and link your issue if you confirm that it is your bug.

Hi

All my user names are regular ascii. What you found sounds like a different bug. This issue is about copying and pasting image using the rich markdown editor which pastes with absolute paths which leads to broken images on other clients and platforms.

wh201906 commented 1 year ago

I tried the steps in https://github.com/laurent22/joplin/issues/6211#issuecomment-1154139345 and I can reproduce this bug. I'm using the portable version of Joplin v2.9.4 on Windows 10.

Something might be helpful:

  1. When I copy an image with Ctrl+C using the WYSIWYG mode, then paste it to notepad, the image path is an absolute path. 图片
  2. When I copy an image with Ctrl+C using the WYSIWYG mode, then paste it to WYSIWYG editor, then switch back to Markdown editor to check the link, the image path is the internal path. 图片
  3. I set a breakpoint at the beginning of onPaste() in packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx. When I copy then paste an image in WYSIWYG editor, the onPaste() will handle the ABSOLUTE path even before editor.insertContent(modifiedHtml) (The modifiedHtml contains the absolute path) 图片
  4. I guess there are some conversions after onPaste() to convert the absolute path into the internal path, but I failed to track what happens after onPaste()
  5. I can reproduce it in Linux. 图片 I build 62eee4d then run it on Ubuntu with Xfce desktop. Here are the details. 图片
  6. On Linux, I can paste the image to gedit(a GUI editor), but I can't paste it to nano(a terminal editor). the paste result is an absolute path. 图片
wh201906 commented 1 year ago

I guess I've figured out what happens.

Firstly, when copying an image from WYSIWYG editor, you will always get the full path of an image Then, for WYSIWYG editor(TinyMCE), the onPaste() will insert the html code of an image in it. After that, the handler of onChange event will generate the Markdown code based on the html code, by using props.htmlToMarkdown. The implementation of this function will call Note.replaceResourceExternalToInternalLinks() to replace the absolute path to the internal path. For Markdown editor(and other external text editor), the Note.replaceResourceExternalToInternalLinks() will not be called, so you will only get the absolute path. When pasting an image copied in WYSIWYG editor to Markdown editor, the editorPaste() will be called and the clipboardText is like ![image name](absolute path). I think adding something there will fix this issue.

gerroon commented 1 year ago

@laurent22, it sounds like @wh201906 pretty much figured out the bug that is causing this issue.