Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error #3

Closed
djcedr opened this issue Jan 13, 2021 · 12 comments
Closed

Error #3

djcedr opened this issue Jan 13, 2021 · 12 comments

Comments

@djcedr
Copy link

djcedr commented Jan 13, 2021

Hi, for some reason I get an error while trying to use UnzipGs. The fileId is correct and I'm not using v8 with this...
Any idea please?
Thanks!
Cédric

Error
InternalError: Cannot convert Array to (class)[].,Exception: Could not unzip.
(anonymous) @ Code.gs:63
unzip @ Code.gs:18
sample @ Code.gs:6

@djcedr
Copy link
Author

djcedr commented Jan 13, 2021

@tanaikech, tagging you just to make sure you get a notification - thanks!

@tanaikech
Copy link
Owner

tanaikech commented Jan 14, 2021

Thank you for your comment. Unfortunately, from your comment, I cannot replicate your situation. This is due to my poor skill. I deeply apologize for this. By the way, I think that from your error message, this might be due to the library of "unzip.min.js". How about this?

Unfortunately, I cannot still replicate your issue. I apologize for my poor skill. In order to correctly understand about your situation, can you provide the detail flow and your whole script? By this, I would like to confirm it.

@tanaikech tanaikech reopened this Jan 14, 2021
@tanaikech
Copy link
Owner

Sorry. I accidentally closed it.

@djcedr
Copy link
Author

djcedr commented Jan 14, 2021 via email

@djcedr
Copy link
Author

djcedr commented Jan 14, 2021

function sample() {
  var id = "1waF7qoTO_OBt2r4q4oEMJOKRi0CccYik"; // File ID of Zip file.
  var pass = "password"; // Password.

  var blob = DriveApp.getFileById(id).getBlob();
  var res = UnzipGs.unzip(blob, { password: pass }); // or UnzipGs.unzip(blob);
  res.forEach(function(e) {
    Logger.log(
      "filename: %s, mimeType: %s, size: %s",
      e.getName(),
      e.getContentType(),
      e.getBytes().length
    );
  });
}

@tanaikech
Copy link
Owner

Thank you for replying. Unfortunately, I cannot replicate your situation. I deeply apologize for this.

By the way, as I have already said, this library uses "unzip.min.js". So I thought that your issue might be due to "unzip.min.js". Because the error occurs at https://github.com/tanaikech/UnzipGs/blob/master/UnzipGs.js#L63 How do you think about it? If my understanding is correct, I think that this might depend on the ZIP data. In this case, I cannot resolve your issue. I apologize for this.

@djcedr
Copy link
Author

djcedr commented Jan 14, 2021 via email

@tanaikech
Copy link
Owner

Thank you for replying. I deeply apologize that I couldn't be useful. This is due to my poor skill. I would like to study more and more.

@ghost
Copy link

ghost commented Apr 22, 2021

Hi. Sorry for my bad English.
I guess toGas occur the InternalError.
You know, range of Blob[] values is -128 to 127.
So when taking 128 expect -128, but this code computes 128 to 128.
And, Utilities.newBlob([128]) will crash.

    toGas = function(ar_) {
      var a;
      a = ar_.map(function(e) {
        var res;
-        res = e > 128 ? e - 256 : e;
+        res = e >= 128 ? e - 256 : e;
        return res;
      });
      return Utilities.newBlob(a);
    };

@tanaikech
Copy link
Owner

@takumab21 Thank you for your comment. I could confirm it. Now, I fixed it and updated to v1.0.1. Could you please confirm it? https://github.com/tanaikech/UnzipGs#update-history

@ghost
Copy link

ghost commented Apr 22, 2021

@tanaikech
Thank you for your quick response.
I ran djcedr's sample code with my ZIP file which has problem same as first comment by v1.0.1 (v2 on GAS), seems to work good.

@tanaikech
Copy link
Owner

@takumab21 Thank you for testing it. The issue was able to be resolved by your support. Thank you so much.

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

No branches or pull requests

2 participants