Can't define more than one file handler

Problem description:
I can’t define more than one file handler in the extension manifest.
Note: when I define only one handler, it works perfectly. This is about more than one file handlers breaking everything

Expected behavior:
Defining more than one file handler works, and the context menu for all the file types specified contains the file handler button

Actual behavior:
Defining more than one file handler in the manifest causes the extension to stop loading. (“Failed to load extension manifest”)

Steps to reproduce:

  1. Create an extension
  2. Fill out all of the fields
  3. Replace the fileHandlers field with the one specified below
  4. Load the extension
  5. Notice the manifest does not load, and then remove the extension
  6. Remove the second file handler from the fileHandlers list
  7. Load the extension
  8. Notice the extension loads

Bug appears at this link:
https://Git-Diff-Viewer-Extension.grimsteel.repl.co

{
  "fileHandlers": [
    {
      "glob": "*.diff",
      "handler": "index.html",
      "name": "Diff Viewer"
    },
    {
      "glob": "*.patch",
      "handler": "index.html",
      "name": "Patch Viewer"
    }
  ]
}

Browser/OS/Device:
Chromium 109 on Ubuntu

2 Likes

sorry about this, there will be better error information available from later today

3 Likes

That sounds great! Is this feature released already? (I know Replit is a PWA so I might need to force a service worker update before I get the new feature)

2 Likes

I figured out the solution by inspecting Replit’s source code!

Apparently if you have more than one file handler, the icon and name fields are required.

@ArnavBansal I think a docs page made by the extensions beta community would be really useful because then we could add tips like this for other extensions devs to reference

2 Likes

Thanks for figuring this out, I had the same issue! I’ll add this to my extension manifest checker: https://replit-extension-manifest-checker.luisafk.repl.co/

1 Like

This is still not working for me, even setting name and icon:

{
  "fileHandlers": [
    {
      "glob": "*.sb3",
      "handler": "/editSb3.html",
      "name": "Scratch Editor"
    },
    {
      "glob": "*.md",
      "handler": "/packageSb3.html",
      "name": "Scratch Packager",
      "icon": "scratch-og.png"
    }
  ]
}

Works fine with only one though.

You need to set the icon property on all of the file handlers

1 Like

Yep, thanks! Gonna update my manifest checker real quick.

1 Like

Thanks for figuring this out

Manifest errors should now show up in the extensions sidebar now. Sorry for the inconvenience

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.