drummerSupport icon indicating copy to clipboard operation
drummerSupport copied to clipboard

How to make a weird tab using tab.openFile

Open PostMonsterG opened this issue 4 years ago • 2 comments

I don't know how to describe it, but I am conceptualizing it as "I have made a wormhole inside Drummer"

Drummer v2.0.11

Steps to reproduce

  • Ensure you don't have a document named TabSmasher.opml
  • Run this code in some other tab tab.openFile("TabSmasher.opml")

What happens

  • New tab named TabSmasher opens up
  • Contents are tab you were in previously
  • No close control for the tab

What should happen

  • I dunno, maybe a new tab with empty contents, named TabSmasher
  • An error could also make sense
  • Should this file get persisted at next save?

Notes

  • This might be creating an alias or pointer to the tab you were in, but it might be replacing contents
  • You can do things like edit OPML Headers and change names around for this odd tab, I can't tell if it's really untitled or what. It's possible this bug is due to a mismatch between how Drummer displays and finds tabs by name (total wild guess)
  • I think I've managed to overwrite the contents of an existing file this way, but I don't have repro steps for that, so I can't be sure.
  • If these steps don't work please let me know and I'll poke it again

PostMonsterG avatar Nov 21 '21 00:11 PostMonsterG

See https://github.com/scripting/drummerSupport/issues/126, this might solve your problem.

andysylvester avatar Nov 26 '21 21:11 andysylvester

PostMonsterG, I followed the steps listed above and I saw the same results (new tab opened, contents of previously active tab were copied over to the new tab, new tab does not have a close control). Here is what appeared in the Javascript console:

runScriptText: processedScriptText == (async function () {await processRunCursorScriptResult(await tab.openFile('TabSmasher.opml'), 1);})() jquery-1.9.1.min.js:5 GET http://drummer.scripting.com/getfile?oauth_token=1302741194351411200-KtaMuteCIb6aN8V0DmxUBy9jfSpMrQ&oauth_token_secret=xKOWFiRMMi6bgmrpnYoZblDb8P3PT9DyY41lT4rrQo1u0&relpath=TabSmasher.opml&flIncludeBody=true 500 (Internal Server Error) send @ jquery-1.9.1.min.js:5 ajax @ jquery-1.9.1.min.js:5 twGetFile @ api.js:362 drummerGetFile @ code.js:386 downloadFile @ code.js:1738 getOutlineOpmltext @ code.js:591 activateThisOutline @ code.js:900 newOutlineInTab @ code.js:1209 openOutlineInTab @ code.js:1278 (anonymous) @ verbs.js:321 openFile @ verbs.js:320 eval @ VM50:1 eval @ VM50:1 (anonymous) @ scripting.js:47 runScriptText @ scripting.js:49 runCursorScript @ code.js:2613 onclick @ (index):1 api.js:369 twGetFile: error == { "readyState": 4, "responseText": "{\n "errno": -2,\n "code": "NoSuchKey",\n "syscall": "open",\n "path": "publicFiles/users/PDXProtestNews/TabSmasher.opml",\n "status": 500\n}", "status": 500, "statusText": "Internal Server Error" }

I will continue to investigate, will report back.

andysylvester avatar Dec 18 '21 20:12 andysylvester