Socket
Socket
Sign inDemoInstall

rc-upload

Package Overview
Dependencies
Maintainers
3
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-upload - npm Package Compare versions

Comparing version 1.6.0 to 1.6.4

39

lib/IframeUploader.js

@@ -55,3 +55,8 @@ 'use strict';

try {
response = this.getIframeDocument().body.innerHTML;
var doc = this.getIframeDocument();
var script = doc.getElementsByTagName('script')[0];
if (script && script.parentNode === doc.body) {
doc.body.removeChild(script);
}
response = doc.body.innerHTML;
props.onSuccess(response, eventFile);

@@ -94,3 +99,3 @@ } catch (err) {

getIframeNode: function getIframeNode() {
return _react2['default'].findDOMNode(this.refs.iframe);
return _react2['default'].findDOMNode(this).firstChild;
},

@@ -118,4 +123,10 @@

getIframeHTML: function getIframeHTML() {
return '\n <!DOCTYPE html>\n <html>\n <head>\n <meta http-equiv="X-UA-Compatible" content="IE=edge" />\n <style>\n body,html {padding:0;margin:0;border:0;overflow:hidden;}\n </style>\n </head>\n <body>\n <form method="post"\n encType="multipart/form-data"\n action="' + this.props.action + '" id="form" style="display:block;height:9999px;position:relative;overflow:hidden;">\n <input id="input" type="file"\n name="' + this.props.name + '"\n style="position:absolute;top:0;right:0;height:9999px;font-size:9999px;cursor:pointer;"/>\n <span id="data"></span>\n </form>\n </body>\n </html>\n ';
getIframeHTML: function getIframeHTML(domain) {
var domainScript = '';
var domainInput = '';
if (domain) {
domainScript = '<script>document.domain="' + domain + '";</script>';
domainInput = '<input name="_documentDomain" value="' + domain + '" />';
}
return '\n <!DOCTYPE html>\n <html>\n <head>\n <meta http-equiv="X-UA-Compatible" content="IE=edge" />\n <style>\n body,html {padding:0;margin:0;border:0;overflow:hidden;}\n </style>\n ' + domainScript + '\n </head>\n <body>\n <form method="post"\n encType="multipart/form-data"\n action="' + this.props.action + '" id="form" style="display:block;height:9999px;position:relative;overflow:hidden;">\n <input id="input" type="file"\n name="' + this.props.name + '"\n style="position:absolute;top:0;right:0;height:9999px;font-size:9999px;cursor:pointer;"/>\n ' + domainInput + '\n <span id="data"></span>\n </form>\n </body>\n </html>\n ';
},

@@ -134,8 +145,24 @@

initIframeSrc: function initIframeSrc() {
if (this.domain) {
this.getIframeNode().src = 'javascript:void((function(){\n var d = document;\n d.open();\n d.domain=\'' + this.domain + '\';\n d.write(\'\');\n d.close();\n })())';
}
},
initIframe: function initIframe() {
var iframeNode = this.getIframeNode();
var win = iframeNode.contentWindow;
var doc = win.document;
var doc = undefined;
this.domain = this.domain || '';
this.initIframeSrc();
try {
doc = win.document;
} catch (e) {
this.domain = document.domain;
this.initIframeSrc();
win = iframeNode.contentWindow;
doc = win.document;
}
doc.open('text/html', 'replace');
doc.write(this.getIframeHTML());
doc.write(this.getIframeHTML(this.domain));
doc.close();

@@ -142,0 +169,0 @@ this.getFormInputNode().onchange = this.onChange;

2

package.json
{
"name": "rc-upload",
"version": "1.6.0",
"version": "1.6.4",
"description": "upload ui component for react",

@@ -5,0 +5,0 @@ "keywords": [

@@ -72,4 +72,17 @@ # rc-upload

### Note
if run at ie and set document.domain, then server should output document.domain according to _documentDomain parameter
```js
var ret = '';
if(postData._documentDomain){
ret+='<script>document.domain="'+postData._documentDomain+'";</script>'
}
this.body = ret +'{"url":"xx.jpq"}';
```
## License
rc-upload is released under the MIT license.
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