Bug #1723

Updated by Abdelghani Omari over 5 years ago

In this function I noticed two things:
  - it stops at 5000000 without warning
  - I do not understand the condition (if(len > 5000000 || data.GetLength() + len < 5000000))
why (len > 5000000) ? perhaps it will be (len < 5000000)
- 5000000 as limit is too small.

<pre>
void Ide::IdePaste(String& data)
{
data.Clear();
if(AcceptFiles(Clipboard())) {
Vector<String> s = GetFiles(Clipboard());
for(int i = 0; i < s.GetCount(); i++)
if(FileExists(s[i]) && IsTextFile(s[i], 10000)) {
int64 len = GetFileLength(s[i]);
if(len > 5000000 || data.GetLength() + len < 5000000)
data.Cat(LoadFile(s[i]));
}
}
}

</pre>

here the patched function:
<pre>

void Ide::IdePaste(String& data)
{
data.Clear();
if(AcceptFiles(Clipboard())) {
Vector<String> s = GetFiles(Clipboard());
for(int i = 0; i < s.GetCount(); i++)
if(FileExists(s[i]) && IsTextFile(s[i], 10000)) {
int64 len = GetFileLength(s[i]);
if( data.GetLength() + len > 104857600) {
Exclamation("The file size reaches the limit of 100 MB.");
return;
}

data.Cat(LoadFile(s[i]));
}
}
}

</pre>

Back