Skip to content

Instantly share code, notes, and snippets.

@gnanet
Created February 6, 2015 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnanet/7ad70e101af2738575a4 to your computer and use it in GitHub Desktop.
Save gnanet/7ad70e101af2738575a4 to your computer and use it in GitHub Desktop.
Represent real remote filesize over 4GB in owncloud 6
--- SFTP.php 2015-02-06 22:12:50.489904403 +0100
+++ SFTP.php 2015-02-06 22:14:35.188130523 +0100
@@ -1773,12 +1773,16 @@
// of course, you shouldn't be using Net_SFTP to transfer files that are in excess of 4GB
// (0xFFFFFFFF bytes), anyway. as such, we'll just represent all file sizes that are bigger than
// 4GB as being 4GB.
+// extract(unpack('Nupper/Nsize', $this->_string_shift($response, 8)));
+// if ($upper) {
+// $attr['size'] = 0xFFFFFFFF;
+// } else {
+// $attr['size'] = $size < 0 ? ($size & 0x7FFFFFFF) + 0x80000000 : $size;
+// }
+// break;
extract(unpack('Nupper/Nsize', $this->_string_shift($response, 8)));
- if ($upper) {
- $attr['size'] = 0xFFFFFFFF;
- } else {
- $attr['size'] = $size < 0 ? ($size & 0x7FFFFFFF) + 0x80000000 : $size;
- }
+ $attr['size'] = $upper ? 4294967296 * $upper : 0;
+ $attr['size']+= $size < 0 ? ($size & 0x7FFFFFFF) + 0x80000000 : $size;
break;
case NET_SFTP_ATTR_UIDGID: // 0x00000002 (SFTPv3 only)
$attr+= unpack('Nuid/Ngid', $this->_string_shift($response, 8));
@@ -2026,4 +2030,4 @@
$this->pwd = false;
parent::_disconnect($reason);
}
-}
\ No newline at end of file
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment