Handling for file transfer in submit plugins#1739
Open
zane-perry wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates SynBioHub’s plugin proxy endpoint to better support submit plugins that need to transfer file content, and increases request body size limits to accommodate larger payloads.
Changes:
- Added submit-plugin request preprocessing to write inline
contentBase64manifest files to a temporary directory and forward an updated manifest to the plugin. - Added post-request cleanup logic for temporary submit-plugin files.
- Increased global
body-parserJSON and URL-encoded limits to50mb.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| lib/plugins/pluginEndpoints.js | Adds submit-plugin data preparation (inline base64 → temp files), and cleanup after plugin run requests. |
| lib/app-middleware.js | Raises global request body size limits to support larger plugin payloads. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+212
to
+218
| cleanup: () => { | ||
| try { | ||
| fs.rmSync(tempDir, { recursive: true, force: true }) | ||
| } catch (error) { | ||
| // best effort cleanup | ||
| } | ||
| } |
Comment on lines
+190
to
+200
| const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'sbh-submit-plugin-')) | ||
| const preparedFiles = manifestFiles.map((file, index) => { | ||
| if (typeof file.contentBase64 === 'string' && file.contentBase64.length > 0) { | ||
| const safeFilename = path.basename(file.filename || `plugin_input_${index}`) | ||
| const localPath = path.join(tempDir, safeFilename) | ||
| fs.writeFileSync(localPath, Buffer.from(file.contentBase64, 'base64')) | ||
| return { | ||
| ...file, | ||
| url: localPath | ||
| } | ||
| } |
Comment on lines
+190
to
+196
| const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'sbh-submit-plugin-')) | ||
| const preparedFiles = manifestFiles.map((file, index) => { | ||
| if (typeof file.contentBase64 === 'string' && file.contentBase64.length > 0) { | ||
| const safeFilename = path.basename(file.filename || `plugin_input_${index}`) | ||
| const localPath = path.join(tempDir, safeFilename) | ||
| fs.writeFileSync(localPath, Buffer.from(file.contentBase64, 'base64')) | ||
| return { |
Comment on lines
+191
to
+201
| const preparedFiles = manifestFiles.map((file, index) => { | ||
| if (typeof file.contentBase64 === 'string' && file.contentBase64.length > 0) { | ||
| const safeFilename = path.basename(file.filename || `plugin_input_${index}`) | ||
| const localPath = path.join(tempDir, safeFilename) | ||
| fs.writeFileSync(localPath, Buffer.from(file.contentBase64, 'base64')) | ||
| return { | ||
| ...file, | ||
| url: localPath | ||
| } | ||
| } | ||
| return file |
Comment on lines
41
to
48
| app.use( | ||
| bodyParser.urlencoded({ | ||
| extended: true | ||
| extended: true, | ||
| limit: '50mb' | ||
| }) | ||
| ) | ||
| app.use(bodyParser.json()) | ||
| app.use(bodyParser.json({ limit: '50mb' })) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.