Skip to content

Commit

Permalink
fix(api-comments): correct the conversion of the base64 data used in …
Browse files Browse the repository at this point in the history
…command
  • Loading branch information
laurent-laporte-pro committed Mar 5, 2024
1 parent af1aed1 commit cd9c4e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion antarest/study/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def edit_comments(
command = [
UpdateRawFile(
target="settings/comments",
b64Data=base64.b64encode(bytes(data.comments, "utf-8")),
b64Data=base64.b64encode(data.comments.encode("utf-8")).decode("utf-8"),
command_context=variant_study_service.command_factory.command_context,
)
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ class UpdateRawFile(ICommand):
target: str
b64Data: str

def __repr__(self) -> str:
cls = self.__class__.__name__
target = self.target
try:
data = base64.decodebytes(self.b64Data.encode("utf-8")).decode("utf-8")
return f"{cls}(target={target!r}, data={data!r})"
except (ValueError, TypeError):
return f"{cls}(target={target!r}, b64Data={self.b64Data!r})"

def _apply_config(self, study_data: FileStudyTreeConfig) -> Tuple[CommandOutput, Dict[str, Any]]:
return CommandOutput(status=True, message="ok"), {}

Expand Down

0 comments on commit cd9c4e0

Please sign in to comment.