drummerSupport icon indicating copy to clipboard operation
drummerSupport copied to clipboard

Empty tab as a result of invalid OPML

Open PostMonsterG opened this issue 4 years ago • 11 comments

Some empty tabs in Drummer may actually be the result of invalid OPML. This issue is not about how the file got to be invalid, this is more how to detect this type of problem.

Discussion

  • I have a file, which, when opened in Drummer, appears as an empty tab.
  • The file, however, is not empty. It contains a valid OPML file, plus four characters
  • Drummer OPML files end with\t</opml>, that is, the final line of the file consists of a tab and </opml>. There is no newline at the end.
  • The corrupted file ends with \t</opml>\nl>\n, that is, there is an extra newline, followed by a lowercase L, a right-angle bracket, and a newline

Determining if a blank tab is caused by invalid OPML

  • If you have a file which you believe may be causing this type of issue, you can test it. Execute this snippet of code, it will either return the contents of the file, or display an error dialog:

opml.parse( file.readWholeFile( "potential-bad-file.opml" ))

Fixing the bad file

  • I don't think I can provide a snippet of code that will fix any corrupted OPML file.
  • In my case, since I know the file is exactly four characters too long, I plan to use fileReadWholeFile, truncate it, and write it back out.

PostMonsterG avatar Jan 09 '22 00:01 PostMonsterG

Is there a reason you can't provide the file itself?

scripting avatar Jan 09 '22 03:01 scripting

Because it wasn't relevant. I think I misunderstood what drummerSupport is for, you can close and delete this.

PostMonsterG avatar Jan 09 '22 06:01 PostMonsterG

Of course I can close the issue, but you seem to be reporting a bug. Why did you post this? Do you want me to investigate?

scripting avatar Jan 09 '22 09:01 scripting

I re-read your post and I think what you're doing is trying to provide support not asking for support. If that is the case, that is not what this place is for, and you should delete the post.

However, I think the best way to deal with this is to teach Drummer not to have a problem with such files. For that I would need an example of how to produce the problem. Of course I can create a file that has invalid OPML and see what happens (and I will do that), or you could help me out and save some time and give me a pointer to the file that caused the problem. That would be an appropriate use of this forum.

Gary, I have so little time, and am so stretched, I don't want these kinds of issues to keep popping up. Please stop trying to test the boundaries. Thanks.

scripting avatar Jan 09 '22 14:01 scripting

As I said, and you confirmed, I misunderstood the purpose. Your question immediately clarified that for me, and I instantly regretted the intrusion.

Any pushing of boundaries was unintentional. I didn't delete this myself because I didn't realize I can do that sort of thing.

PostMonsterG avatar Jan 09 '22 16:01 PostMonsterG

Thank you. 'd like to investigate the problem and make Drummer more resilient so the blank tabs don't happen. Are you willing to help?

scripting avatar Jan 09 '22 16:01 scripting

Yes, of course.

PostMonsterG avatar Jan 09 '22 16:01 PostMonsterG

The previous example wasn't a public outline, but I have one in my Drummer account right now that is. The file is at http://drummer.scripting.com/PostMonsterG/blog.opml and currently shows as empty in Drummer. I have an automated backup of all my Drummer files in GitHub, so I plan on restoring it. That will be later today after work (Pacific time) in case you want to take a snapshot of the file before then.

Unfortunately I do not have good repro steps. I can describe what I was doing. Nothing involving editing icon bars or menus, no scripting, just normal outline editing. Some copy-pasting of outline nodes with embedded a href links but nothing else fancy (I think). I forgot to note which tabs were open at the time, there were several, but none have been problematic for months.

I had copied and pasted the bottom two nodes from http://drummer.scripting.com/PostMonsterG/Previously.opml into http://drummer.scripting.com/PostMonsterG/about.opml and was about to do the same to update the most recent post in blog.opml when I noticed the blank tab. I was unable to close it manually. Hard reload… did not fix that, but Reset tabs… did. I've re-opened the file since but it's still empty for now.

Please let me know if there's anything I can do to assist, including providing previous versions of the file, holding off on fixing it myself, etc. Thanks!

PostMonsterG avatar Jun 17 '22 16:06 PostMonsterG

I don't have any time right now to dig into this, but I did check the file for validity and it's not valid XML.

It's definitely not empty.

In line 308 there are two created atts.

Did you edit the file by hand by an chance?

Dave

scripting avatar Jun 17 '22 16:06 scripting

No, everything is edited in Drummer, using Drummer's UI. Whatever is in that file—I have not looked yet—was written by Drummer.

PostMonsterG avatar Jun 17 '22 17:06 PostMonsterG

I pulled my latest backup from GitHub. This version has dateModified Thu, 16 Jun 2022 21:32:34 GMT. The broken file has dateModified Thu, 16 Jun 2022 21:33:22 GMT, less than a minute later. Line 308 looks OK in the backup version, but the broken file looks pretty broken from that point on down. I will be looking into the diffs to see if I can determine a specific string that can trigger this, and thereby construct an appropriate test case that isn't 650K.

blog-broken.opml.zip blog-lastbackup.opml.zip

PostMonsterG avatar Jun 17 '22 19:06 PostMonsterG