File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,13 @@ internal class StreamHelper
36
36
37
37
public static string GetStreamExtension ( Stream stream )
38
38
{
39
+ // https://github.com/awslabs/aws-sdk-xamarin/blob/master/AWS.XamarinSDK/AWSSDK_Core/Amazon.Runtime/Internal/Util/HashStream.cs
40
+ // Amazon.Runtime.Internal.Util.HashStream.Position {set; get;} throw NotSupportedException. First check CanSeek and default to PDF file extension
41
+ if ( ! stream . CanSeek )
42
+ {
43
+ return ".pdf" ;
44
+ }
45
+
39
46
if ( stream . Length < 4 )
40
47
{
41
48
throw new InvalidDataException ( "Less than 4 bytes found in stream." ) ;
@@ -118,7 +125,12 @@ public static string WriteToTemporaryFile(Stream stream)
118
125
119
126
string path = Path . Combine ( Path . GetTempPath ( ) , Guid . NewGuid ( ) + extension ) ;
120
127
121
- stream . Position = 0 ;
128
+ // https://github.com/awslabs/aws-sdk-xamarin/blob/master/AWS.XamarinSDK/AWSSDK_Core/Amazon.Runtime/Internal/Util/HashStream.cs
129
+ // Amazon.Runtime.Internal.Util.HashStream.Position {set; get;} throw NotSupportedException.
130
+ if ( stream . CanSeek )
131
+ {
132
+ stream . Position = 0 ;
133
+ }
122
134
123
135
using ( FileStream fs = File . Create ( path ) )
124
136
{
You can’t perform that action at this time.
0 commit comments