Closed devblackops closed 6 years ago
I would suggest holding off until 6.1 and then requiring the 6.1 version. 6.1 adds a much easier to swallow multi-part/formdata feature:
$From = @{
file = Get-Item -Path $FileName
token = $Token
filename = Split-Path -Path $Path -Leaf
channels = $Channel -join ", "
title = $Title
'initial_comment' = $Comment
}
Invoke-RestMethod -Uri $Uri -Method Post -Form $Form
PowerShell/PowerShell#5972
I wanted that feature in 6.0.0, but we couldn't get the design nailed down before RC.
Good catch!
Up to you all. I'm good with waiting until that PR is in (6.1?) if it makes sense to you.
@devblackops - that work for you? If you need this for the summit, would working in a branch that has code that works in 6.0.0 work for you? It would be more work, but feel free to submit a temporary workaround (as long as it continues to work in windows powershell) that we can adjust in 6.1
Cheers!
My only issue with waiting for 6.1 is now PSSlack would have a hard dependency on 6.1 in your manifest. It requires 3+ right now and there isn't a way to specify different required versions between Windows PS and core PS. Most people on Windows are not using 6+ yet. If you require 6.1, then everyone else depending on PSSlack requires 6.1.
@RamblingCookieMonster I don't strictly need it for the summit. I'd like to demo PoshBot on macOS but can use Windows if needed. This issue and #57 are the only things I've found so far and #57 really just creates a warning for me.
Yea, if you need backwards compat, I can only seriously recommend the raw .NET APIs (HttpClient in particular). The new multipart/form-data in 6.0 is not backwards compat with 5.x-3.0 either.
Ahh good call! Yeah - if you can do the same code and cover both core and full, even better
Thanks!
More cross-platform fun 😄
Send-SlackFile
is throwing this error on macOS.Something must be wrong with the value of $bodyLines on macOS/linux.
@markekraus has a nice article on multipart/form-data support. I did some quick tests and this is working on macOS. I also like using .net methods over a bunch of string concatenation as well.
If you agree, I'll submit a PR to fix.
Cheers