mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Revert "added check for seeking-capability of inputStream in SaveStream before resetting the position"
This reverts commit 085feeb118
.
This commit is contained in:
@@ -26,10 +26,10 @@ namespace Orchard.Azure.Services.FileSystems.Media {
|
||||
|
||||
public bool TrySaveStream(string path, Stream inputStream) {
|
||||
try {
|
||||
if (FileExists(path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FileExists(path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SaveStream(path, inputStream);
|
||||
}
|
||||
catch {
|
||||
@@ -43,9 +43,7 @@ namespace Orchard.Azure.Services.FileSystems.Media {
|
||||
// Create the file. The CreateFile() method will map the still relative path.
|
||||
var file = CreateFile(path);
|
||||
|
||||
if (inputStream.CanSeek) {
|
||||
inputStream.Position = 0; // We need to read from the beginning of the stream, even if it isn't at it's beginning.
|
||||
}
|
||||
inputStream.Position = 0; // We need to read from the beginning of the stream, even if it isn't at it's beginning.
|
||||
|
||||
using (var outputStream = file.OpenWrite()) {
|
||||
var buffer = new byte[8192];
|
||||
@@ -56,9 +54,8 @@ namespace Orchard.Azure.Services.FileSystems.Media {
|
||||
outputStream.Write(buffer, 0, length);
|
||||
}
|
||||
}
|
||||
if (inputStream.CanSeek) {
|
||||
inputStream.Position = 0; // Rolling back the stream so external readers will have it easier.
|
||||
}
|
||||
|
||||
inputStream.Position = 0; // Rolling back the stream so external readers will have it easier.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@@ -312,10 +312,10 @@ namespace Orchard.FileSystems.Media {
|
||||
/// <returns>True if success; False otherwise.</returns>
|
||||
public bool TrySaveStream(string path, Stream inputStream) {
|
||||
try {
|
||||
if (FileExists(path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FileExists(path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SaveStream(path, inputStream);
|
||||
}
|
||||
catch {
|
||||
|
Reference in New Issue
Block a user