Skip to content

Handling for file transfer in submit plugins#1739

Open
zane-perry wants to merge 1 commit into
masterfrom
submit-plugin-handling
Open

Handling for file transfer in submit plugins#1739
zane-perry wants to merge 1 commit into
masterfrom
submit-plugin-handling

Conversation

@zane-perry
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 contentBase64 manifest 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-parser JSON and URL-encoded limits to 50mb.

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 thread lib/app-middleware.js
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' }))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants