Skip to content

Commit

Permalink
Use msiBytesBufToStr to convert iRODS bytes buffer to string
Browse files Browse the repository at this point in the history
  • Loading branch information
lwesterhof committed Nov 26, 2024
1 parent 90ed61c commit d745bdb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion util/data_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,12 @@ def read(ctx, path, max_size=constants.IIDATA_MAX_SLURP_SIZE):

buf = ret['arguments'][2]

# Convert BytesBuffer to string.
ret_val = msi.bytes_buf_to_str(ctx, buf, "")
output = ret_val["arguments"][1]
msi.data_obj_close(ctx, handle, 0)

return ''.join(buf.buf[:buf.len])
return output


def copy(ctx, path_org, path_copy, force=True):
Expand Down
1 change: 1 addition & 0 deletions util/msi.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def _make_exception(name, message):
get_obj_type, GetObjTypeError = make('GetObjType', 'Could not get object type')
mod_avu_metadata, ModAVUMetadataError = make('ModAVUMetadata', 'Could not modify AVU metadata')
stat_vault, MSIStatVaultError = make("_stat_vault", 'Could not stat file system object in vault.')
bytes_buf_to_str, BytesBufToStr = make('BytesBufToStr', 'Could not write bytes buffer to string')

# The file checksum microservice should not be invoked directly. This microservice should be invoked via wrap_file_checksum.r wrapper.
file_checksum, FileChecksumError = make("_file_checksum", 'Could not calculate non-persistent checksum of vault file.')
Expand Down

0 comments on commit d745bdb

Please sign in to comment.