OrchardCore icon indicating copy to clipboard operation
OrchardCore copied to clipboard

ReadAsByteArray support for Workflows

Open lampersky opened this issue 3 years ago • 9 comments

it would be great to have additional switch inside HttpRequestTask and HttpResponseTask, which will allow users to choose if content is binary or not, currently both tasks allow us to only use string there, which is quite a big limit

this will allow us to:

  • download binary data like images etc. using HttpRequestTask,
  • return binary content like gifs, pdfs using HttpResponseTask,
  • return binary content using scripting rawResponseWrite method.

Here you can check those extended tasks in action:

anim

Fixes #4634

lampersky avatar Jun 29 '22 16:06 lampersky

Do you agree with me here that binary could be anything?

Skrypt avatar Jun 29 '22 16:06 Skrypt

Do you agree with me here that binary could be anything?

yep, it could be anything

lampersky avatar Jun 29 '22 17:06 lampersky

I think this is something that should be taken care of by the Media module then. Else, we are opening the form requests to send pretty much anything on the server.

Media API ...

Also, where do these files get uploaded? The Media module takes care of this if you are using local storage or Azure storage for example. Here, with the Workflows, nothing is taken care of.

Skrypt avatar Jun 29 '22 17:06 Skrypt

but this small extension is not related with media module...

lampersky avatar Jun 29 '22 17:06 lampersky

I think what you are trying to achieve is to add the option to be able to use a <form enctype="multipart/form-data"> with the Workflows.

Skrypt avatar Jun 29 '22 17:06 Skrypt

Can you replace your demo with a .mpg file produced with ScreenToGif? I'm having a hard time following the .gif if I can't pause it. I believe that on a Mac you can also use OBS for free.

Skrypt avatar Jun 29 '22 17:06 Skrypt

@Skrypt before this PR you were allowed to only return string from the HttpResponseTask, which is great when you are playing with html, json, in general with text files, but sometimes you may want to return non-text file with some binary content like PDF or as mentioned before images

same with HttpRequestTask currently you can only perform request to endpoint which returns text content (json, xml, text, html...) but when you will try to perform request to some endpoint which returns binary content, you will find problem with encodings etc. because current solution is built to work only with endpoints which are returning text content

instead of preparing mpg, I've extracted all frames from gif for you:

1

2

3

4

4a

5

6

7

7a

8

9

10

10a

lampersky avatar Jun 29 '22 22:06 lampersky

This pull request has merge conflicts. Please resolve those before requesting a review.

github-actions[bot] avatar Jan 29 '24 13:01 github-actions[bot]

It seems that this pull request didn't really move for quite a while. Is this something you'd like to revisit any time soon or should we close? Please comment if you'd like to pick it up.

github-actions[bot] avatar Jun 26 '24 02:06 github-actions[bot]

Closing this pull request because it has been stale for very long. If you think this is still relevant, feel free to reopen it.

github-actions[bot] avatar Jul 11 '24 04:07 github-actions[bot]