[Pending] Exporting a note to a samba share (Version 3)

I’m using Drafts on iOS. I have a samba share on my local network that my phone can read/write to fine. I would like to make an action to export a draft to a folder on this samba share.

I created a new action with the step of “Export” and it just names it [[title] and adds [[draft]] to it.

When I run the action a dialog pops up that lets me choose the destination, and my samba share is listed. It even allows me to create a new folder if I want (I tried this and it worked fine). But when I tap save to export the draft an error pops up saying “The operation couldn’t be completed. Operation canceled. Operation canceled” (yeah, it says operation canceled twice).

So the folder I created is there on the samba share, but the draft never makes it. Any ideas to start troubleshooting this?

Edit: I am using an iPhone 11 Pro, on iOS 14.1

Thanks!

What’s wrong with the built-action “Save to Files”?

Is there a way to point it to a samba share?

I thought that action was only for local or icloud files.

If you say “Samba share”, I suppose that you simply mean an SMB server, right? In that case: Connect to it first in the Files app. Otherwise, it won’t be possible at all. If the share appears in the Files app, it is also available in the “Save to Files” action. I just tried it. You may have to scroll down, though.

Yes my SMB server is connected to the Files app.

When I use the “Save to Files” action I get the same result as in the first post. It just say’s it couldn’t be completed, operation canceled.

So you can save files from other apps there, just not from Drafts? E.g., did you try saving a pictures from the Fotos app there (sharing icon, Save in Files…)?

Yes, I just tried saving an image from Photos and it worked great, showed right up in the SMB server in the same folder I have been trying Drafts in.

Then I’m out of ideas.

Try using [[safe_title]] as the file name.

Thanks. The action “Save to Files” is using [[safe_title]] as the file name. And it works just fine saving anywhere in icloud drive, except my SMB server.

I can create a new folder in the SMB just fine which tells me I have write access… I also just tried again with a filename that conflicted and it alerted me that a file in that location existed already, but it still won’t save the draft there. “Operation Canceled”

Are you by any chance using a Synology server? I’ve found references to a problem like this on the net (with a duplicated error message, too), but it concerned the connection phase. Maybe if you dig around on the net …

I have not experimented with Samba shares in the Files app, can you use this connected share successfully when saving from other apps? Like via “Save to Files” options in share sheets in Safari, etc.?

Drafts can only write directly (without prompting) to its own sandbox containers (like the Drafts folder in iCloud Drive). The “Export” type actions prompt through the browser provided by the Files app - so once that prompt appears, Drafts has write a file to disk locally, and handed it off to the system to prompt you for its final destination - which all runs out-of-process of Drafts.

Then Drafts just gets back an “it worked” or “it didn’t work” result from the system.

My SMB share is hosted on a PC running linux. Perhaps there’s something in the .conf I can play around with. It’s interesting that Drafts will let me create folders from that same prompt, just not save the draft in any SMB location.

Thanks for the help, I’ll dig around for other possibilities causing this.

Yes I have tested saving pictures from the Photos app on my phone. It is able to save a picture to the samba share without trouble. And as mentioned above, Drafts will let me create folders in the samba share without trouble as well. I just get this error message ("The operation couldn’t be completed. Operation canceled. Operation canceled”) when I try to save a Draft to it.

I did notice if I try to open one of these text files through the iOS Files app, it bounces me out of Files to another text app I have installed to edit the file. Not sure if that is telling of anything or not yet.

I am running this SMB share from a linux pc. I don’t know if theres something in my .conf that is conflicting but by being able to create folders just fine I am assuming Drafts can go through Files.app and perform writes to the SMB so writing text files to it shouldn’t be different…

I’ve just tried exporting using a simple export action, and was able to save successfully to a share in my QNAP NAS, the underlying OS of which is Linux-flavoured.

Do you get the same issue if you use the built-in export operation from the Drafts list?

Use the select and operations option in the list to select the Drafts to export.

Do you have any other devices that could offer an equivalent external share that you could try saving to?

Another alternative if you get stuck could be to utilise an app like Secure ShellFish to save over SFTP. I tend to use this for my NAS as I can then access from outside my home too with my setup.

Thanks for the idea. I tried that route of using the select -> operations to pick Export. It gives the same error though.

What SMB level do you use on your Samba server? It seems that Files needs at least 3.

smbstatus reports my macbook pro is connected to it using SMB3_02 (3.02?)

Samba version is 4.13.0

it doesn’t list my phone when I run it, maybe because it’s not currently trying to access it?

at the bottom of smbstatus’ output though, I see a Locked files: section. It lists the folder I am trying to write to and says it’s “DENY_NONE” but also lists it as “RDONLY”. In my smb.conf file I have these:

read only = no
writable = yes

so I’m not sure why it’s showing that way in smbstatus but this might be part of the issue, I am reading up on things now.

Okay I just disconnected the macbook and checked again, it did list my phone as connected that time and no locked files. However I still get the same error when trying to Save to Files export the draft.