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

[BUG] 解碼器無法被正常執行 #248

Open
Capsule7446 opened this issue May 2, 2024 · 2 comments
Open

[BUG] 解碼器無法被正常執行 #248

Capsule7446 opened this issue May 2, 2024 · 2 comments

Comments

@Capsule7446
Copy link

Tiny RDM Version
V1.1.11

OS Version
MacOS Sonoma 14.4.1

Redis Version
v6.2.6

Describe the bug
提供自訂義腳本解碼和編碼,但是無法被成功執行,通過zsh是正常執行

提供一個範例腳本,同樣無法執行

const zlib = require('zlib');
const Buffer = require('buffer').Buffer;

const compressedData = Buffer.from(process.argv[2], 'base64');
zlib.gunzip(compressedData, (err, decompressedData) => {
  if (err) {
    console.error(err.toString());
  } else {
    const output = decompressedData.toString('utf-8');
    console.log(output);
  }
});

這是我的設定介面
image

@tiny-craft
Copy link
Owner

mac下正式环境貌似执行外部命令有问题。

不过你这个返回值也有问题,需要转回base64再返回。以下代码在调试环境下可以执行

const zlib = require('zlib');
const Buffer = require('buffer').Buffer;

const compressedData = Buffer.from(process.argv[2], 'base64');
zlib.gunzip(compressedData, (err, decompressedData) => {
  if (err) {
    console.log('[RDM-ERROR]');
  } else {
    const output = decompressedData.toString('base64');
    console.log(output);
  }
});

正式环境我找时间查下什么问题

@tiny-craft
Copy link
Owner

又测试了下,你填node的全路径是不影响的。你就用楼上我贴的代码应该就可以了

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