Problem with UUID links

I downloaded the action Meta Data <> Draft from the actions site of Drafts.
When I use it, I get a new draft with informations as described for the action.
But when I click again on the action, I get an error saying: Unable to find source draft. If I go back manually to the source draft and click on the action, I get back to the Meta Data draft. Again clicking on the action I get the same error.
Also, if I go to the information panel of a draft and click on the “Link”, I get the message that the link is copied to the clipboard. I I open a new draft and paste the link, then open a preview window and I click on the link on that window, I get the same error not finding the source draft. Same problem if I use the button at the bottom of a draft to open a preview window. But, if I click on the “Link” button at the bottom of the draft, I see the link becoming active and if I click on it I go the the source draft!

My setup:
iPad Pro (iOS 15, up to date)
Drafts Pro (version 30.1)
Syntax: MultiMarkdown

Any idea?

Thanks

Robert

1 Like

Looks like that action needed a minor update to account for a change in the default drafts link URLs. I’ve updated the action, you can update your installed version or re-install from the directory to get the fix:

Many thanks Greg,
The action works now correctly.

But, my second problem is: if I create a link using the info panel and paste it in a new draft and open a preview window (using the preview icon) when I click on the link I still get the message: “Draft not found for UUID”. It does the same thing if I open another preview window (from an action). But if I use the link icon at the bottom of the Draft window, it works!

???

Robert

Can’t reproduce. Are you working on a valid draft with content in it?

On “update your installed version” how do I check which actions have updates? Is it a manual process? Could it be automated? (Not to install the updates necessarily, but to know which ones to think about updating?)

Hello Greg,
Yes I’m using a valid draft document. I’ve been using Drafts for ages now and with the Pro version since day one.

I include a small video of what I see happening, so you can see what I mean.

Thanks again

Robert

Link to my Dropbox for the video: Dropbox - Vidéo 2022-01-01 11 28 59.mp4 - Simplify your life

That’s…interesting. I tried to reproduce the steps in the video on my iPad, and it worked as expected. Not immediately obvious what might be different. If you have typed some text in a draft, it is a valid draft, and the UUID should be committed to storage and the link work.

Is this exclusive to a newly created draft? If you paste the link into Safari to open it in Drafts, instead of the Preview, andy difference?

I tried it using old drafts and I had the same problem. In the video I showed coping the link in Safari and it is working correctly I get back to the original draft.
I also uninstalled Drafts and reinstalled it. Waited for the synch to finish. Tried again with same results.
Also I have the same problem on my iPhone 12 Max Pro. Doing exactly the same procedure gives me the same results.

I don’t know…

Robert

Working okay for me with those same steps on my iPhone.

  • Any chance you are using an old or beta version of the OS, or an old version of Drafts?
  • What happens if you switch to link mode and try the same link directly in the editor? Does that work?
  • Can you share the HTML being produced by the Preview? It should be available from the share sheet in the preview. You can share it between triple back ticks here so it appears as a code block rather than being interpreted by the forum as HTML.
HTML from my preview
<!DOCTYPE html>
<html dir="auto">

<head>
  <title>drafts://open?uuid=3E868365-2C50-4193-8496-EA80C12A48BC</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <style>
    @charset "utf-8";

    :root {
      --main-bg-color: white;
      --main-color: black;
      --alternate-bg-color: #efefef;
      --alternate-color: #222222;
      --main-border-color: #BBBBBB;
        --link-color: #627EC9;
    }

    @media (prefers-color-scheme: dark) {
      :root {
        --main-bg-color: #222222;
        --main-color: #eeeeee;
        --alternate-bg-color: #444444;
        --alternate-color: #cccccc;
        --main-border-color: #AAAAAA;
          --link-color: #627EC9;
      }
    }

    html {
      font-size: 100%;
      font-family: -apple-system, BlinkMacSystemFont, "helvetica neue", helvetica, roboto, noto, "segoe ui", arial, sans-serif;
      line-height: 1.4em;
    }

    body {
      margin: 0;
      padding: 1em;
      background-color: var(--main-bg-color);
      color: var(--main-color);
    }

    @media (max-device-width: 480px) {}

    @media (min-device-width: 481px) {
      body {
        margin: auto;
        max-width: 600px;
      }
    }

    blockquote {
      font-style: italic;
      margin: 1.5em 2em;
      padding: 1em;
      background-color: var(--alternate-bg-color);
      color: var(--alternate-color);
    }

    a {
      color: var(--link-color);
    }
    pre {
      display: block;
      overflow: scroll;
      width: 100%;
      background-color: var(--alternate-bg-color);
      padding: .5em 1em;
      margin: 1em 0;
    }

    code {
      background-color: var(--alternate-bg-color);
      color: var(--alternate-color);
      font-family: Menlo, Courier, sans-serif;
      padding: 2px 3px;
    }

    table {
      margin: 1.5em 0;
      border: 1px solid var(--main-border-color);
      border-collapse: collapse;
    }

    th {
      padding: .25em .5em;
      background: var(--alternate-bg-color);
      border: 1px solid var(--main-border-color);
    }

    td {
      padding: .25em .5em;
      border: 1px solid var(--main-border-color);
    }

    img {
      max-width: 90%;
    }
  </style>
</head>

<body>
  <p>drafts://open?uuid=3E868365-2C50-4193-8496-EA80C12A48BC</p>

</body>

</html>

I was actually a little surprised that the UUID URI wasn’t being converted to a link in the preview HTML, but checking the output I still think is worthwhile given it is so quick to do.

Hello @sylumer ,
Thanks for getting into this problem :slight_smile:

  • I’m using an up to date version of Drafts (I even uninstalled my version and reloaded from App Store). My version of iOS is current (15.2). All are original versions.

  • if I switch the “link” mode and click on the link in my draft, it is working as expected, opens the original draft document.

  • Output from the Preview (HTML):

<html dir="auto">
<head>
<title>Preview</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
@charset "utf-8";

html { 
	font-size: 100%;
	font-family: "Helvetica Neue", "Helvetica", sans-serif;
}
body {
	margin:0;
	padding:1em;
}
@media (max-device-width: 480px) { 

} 
@media (min-device-width: 481px) { 
	body {
		margin:auto;
		max-width:600px;
	} 
}

blockquote {
	font-style: italic;
}

code {
    border-radius: 3px;
    background-color: #F8F8F8;
    color: inherit;
}

table {
  margin: 1em 0;
  border: 1px solid #aaa;
  border-collapse: collapse;
}

th {
  padding:.25em .5em;
  background: #efefef;
  border: 1px solid #ccc;  
}

td {
  padding:.25em .5em;
  border: 1px solid #ccc;
}

img {
    max-width: 90%;
}

</style>

<link rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>


</head>
<body>
  <p>drafts://open?uuid=EF68F3CC-0B6B-4120&#8211;994F-4CB69C2F7A4C</p>

</body>
</html>
  • I get the same problem using the icon at the bottom of the Drafts page document (next to the link icon).

Robert

Drafts version and OS versions look okay. The HTML on the other hand…

The &#8211; is the HTML encoding for an en dash character. That would not be matched to a draft when the URL is being triggered from the preview.

Maybe that gives Greg something to investigate; but I haven’t been getting any such encoding?

Hell again @sylumer ,
That must be the problem! Because if I copy the UUID of a Drafts document and then paste it in the HTML document that I sent then use Preview icon or Preview from an action, the original document is open.
It seems that my version of Drafts has a problem (iPad and iPhone). Don’t know what happened. I already uninstalled my Drafts from my iPad and reinstalled it from App Store and the problem was still there. I will try to uninstall Drafts again, but I’ll reboot my iPad before reinstalling Drafts… Maybe!

Robert

Hello,
I just did some tests.

  1. I uninstalled Drafts. Reboot my iPad. Reinstall Drafts from App Store. Reboot. Tried again: same results, same problems.
  2. My iPad is local to French Canada. I changed my language settings to English Canada. Close and reopen my iPad. Same situation, same results. Changed back to French.
  3. I copied links and UUID for several documents in one Drafts document.
  4. Open the document using Preview.
  5. I copied the last lines of the HTML documents in Drafts.
  6. The same replacement of a “-” with “&#8211” is done in the link and the UUID at the same location. Also, it is consistent between the link and the UUID. Also, the replacement is done only once in certain links/UUIDs, and other it is more then once!
  7. The replacement seems not to happen at the same place for different link/UUID.
  8. Copy of the last lines of the HTML document:
<body>
  <p>Test with different documents</p>

<p>drafts://open?uuid=E260ED3B-80A1&#8211;469B-BD75-B3343F3BB084<br />
E260ED3B-80A1&#8211;469B-BD75-B3343F3BB084</p>

<p>drafts://open?uuid=0937FA00-D953&#8211;4960-BBD0&#8211;9BDDA07A7AD3<br />
0937FA00-D953&#8211;4960-BBD0&#8211;9BDDA07A7AD3</p>

<p>drafts://open?uuid=44AD2A60&#8211;3150&#8211;4319-A711&#8211;72CB8ED1C5E2<br />
44AD2A60&#8211;3150&#8211;4319-A711&#8211;72CB8ED1C5E2</p>

<p>drafts://open?uuid=1285E3CA-F086&#8211;48C5&#8211;8585-D4E6439F6A6C<br />
1285E3CA-F086&#8211;48C5&#8211;8585-D4E6439F6A6C</p>

<p>drafts://open?uuid=D18018DB-33F9&#8211;4E9D-AB6C-AFB4E7322371<br />
D18018DB-33F9&#8211;4E9D-AB6C-AFB4E7322371</p>

</body>
</html>

Hope this could help.

Robert

Hello @agiletortoise , @sylumer
Any more ideas??
Or am I out of luck?

:neutral_face:

Thanks

Robert

  • If I use a standard HTML preview action from the default action groups on my iPhone, the link comes through in the preview pane without the en-dash.
  • If I use the built in preview on my iPad, the link comes through in the preview pane without the en-dash.
  • If I use the built in preview on my Mac, the link comes through in plain text and not as a link at all (and not with an en dash).
  • In each case if I copy the text back into Drafts and check in link mode, or paste into Safari’s address bar and open it, the links work fine.
  • If I modify my links to include either an en dash, or the HTML en dash entity code and try that from link mode, I always, as expected, get Draft not found for UUID error.

It feels like this is something specific to your set up. Could be a software version, a device version thing, an app configuration thing. I don’t know the internal code, so I’m not sure where to look next and I can’t reproduce the issue. Something somewhere seems to be replacing a hyphen with an en dash and applies to both your iPhone and your iPad.

Could you maybe walk through the steps for previewing you use on the iPhone and provide a link to your action that you have installed - I.e. Create the share link yourself, don’t link to an existing action in the directory.

I would also be interested which Markdown options and processor you have enabled in Settings. Drafts is not altering that link, but it’s possible some settings of the Markdown processor would.

Hello @agiletortoise , @sylumer
Thank you so much for taking the time to help me!

I tried changing the Markdown syntax using the default syntax: Markdown, MultiMarkdown or the GitHub. I did not change any settings, just use them as is. Same problem.

I downloaded the “Preview” action that Greg posted a year ago in the Directory. Use it in a test. Same problem.

In that action the conversion is using %%[[draft]]%%. If I modify the action by removing the %%, then I do not have the problem, of course the preview is not a markdown document, but if I press on a link I get to the original Drafts file.

So it seems that something is happening when converting the document. Don’t know why or where it comes from.

Is it possible to reintitialize Drafts to the base form? Like if I was a new user downloading from App Store? I could move/copy my database somewhere so that I would start from scratch? I already tried uninstall and reinstall but sasme problem.

Thanks again

Robert

My question what with Markdown options you have selected in Settings. Syntax highlighting does not affect output/conversion to HTML. That is controlled by the Markdown Settings.

By default, Drafts using MultiMarkdown, but I’m interested what you have selected as the engine, and what options are set. There are options that affect output of links.

I’m using MultiMarkdown as my default setting for new drafts.
I include a screen shot of the settings for MultiMarkdown in the setting panel.

Hope this help.

Thanks,

Robert

Okay, I copied your settings and I got the same results as you!!

I then went through the settings one-by-one for what I’d changed in my own settings to create yours. Each time I used the Preview (action and inbuilt Preview on iPad app) to test the UUID link.

If “Smart Quotes” is enabled, I get the encoding issue. If it is disabled, I do not.

Can you now try it with Multimarkdown’s Smart Quotes option enabled/disabled and see if you get the same failure/success result?