Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ep_fileupload

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ep_fileupload - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

.travis.yml

9

controllers/fileUpload.js

@@ -56,4 +56,9 @@ /**

if (err) throw err;
// FIXME: Calculate URL for real, with path prefix and with https handling
res.send(eejs.require("ep_fileupload/templates/fileUploaded.ejs", {upload: 'http://' + req.headers.host + "/up/" + name}, module));
var regex = /^(https?:\/\/[^\/]+)\//;
var urlBase = 'http://' + req.headers.host;
var matches = regex.exec(req.headers['referer']);
if(typeof req.headers['referer'] != "undefined" && typeof matches[1] != "undefined"){
urlBase = matches[1];
}
res.send(eejs.require("ep_fileupload/templates/fileUploaded.ejs", {upload: urlBase + "/up/" + name}, module));
});

@@ -60,0 +65,0 @@ });

{
"name": "ep_fileupload",
"description": "File upload",
"version": "0.0.9",
"version": "0.0.10",
"author": "RedHog (Egil Moeller) <egil.moller@freecode.no>",

@@ -6,0 +6,0 @@ "contributors": ["johnyma22 (John McLear) <john@mclear.co.uk>"],

$(function(){
var info = {
action: '/fileUpload/',
name: 'uploadfile',
onSubmit: function(file, ext){
action: '../fileUpload/',
name: 'uploadfile',
onSubmit: function(file, ext){ // On submit we do nothing, it'd be nice to do something but mheh..
//console.log('Starting...');
},
onComplete: function(file, response){
// Require the editor..
var padeditor = require('ep_etherpad-lite/static/js/pad_editor').padeditor;
padeditor.ace.replaceRange(undefined, undefined, " " + response.replace(/^\s+|\s+$/g, '') + " ");
// result i.e. "/up/c79133b2c8a97533cc397f8d325ce17a.jpg", trimmed whitespace
var filePath = response.slice(response.indexOf("/up")).trim();
// "http://example.com/subfolder/p/padID" -> "http://example.com/subfolder"
var etherpadRoot = document.location.href.slice(0, document.location.href.indexOf("/p/"));
// "http://example.com/subfolder/up/c79133b2c8a97533cc397f8d325ce17a.jpg"
var fileUri = etherpadRoot + filePath;
// Puts the actual URL in the pad..
padeditor.ace.replaceRange(undefined, undefined, " " + fileUri + " ");
// Put the caret back into the pad
padeditor.ace.focus();
}
}
};
new AjaxUpload($('#uploadFileSubmit'), info);
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc