mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Revert "Rolling back streams in storage providers, fixes #4860"
This reverts commit f8e82be4b9.
There are Stream implementation that don't support seeking so we can't do Position resetting just every time.
This commit is contained in:
-4
@@ -43,8 +43,6 @@ namespace Orchard.Azure.Services.FileSystems.Media {
|
|||||||
// Create the file. The CreateFile() method will map the still relative path.
|
// Create the file. The CreateFile() method will map the still relative path.
|
||||||
var file = CreateFile(path);
|
var file = CreateFile(path);
|
||||||
|
|
||||||
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()) {
|
using (var outputStream = file.OpenWrite()) {
|
||||||
var buffer = new byte[8192];
|
var buffer = new byte[8192];
|
||||||
while (true) {
|
while (true) {
|
||||||
@@ -54,8 +52,6 @@ namespace Orchard.Azure.Services.FileSystems.Media {
|
|||||||
outputStream.Write(buffer, 0, length);
|
outputStream.Write(buffer, 0, length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inputStream.Position = 0; // Rolling back the stream so external readers will have it easier.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -312,10 +312,10 @@ namespace Orchard.FileSystems.Media {
|
|||||||
/// <returns>True if success; False otherwise.</returns>
|
/// <returns>True if success; False otherwise.</returns>
|
||||||
public bool TrySaveStream(string path, Stream inputStream) {
|
public bool TrySaveStream(string path, Stream inputStream) {
|
||||||
try {
|
try {
|
||||||
if (FileExists(path)) {
|
if (FileExists(path)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveStream(path, inputStream);
|
SaveStream(path, inputStream);
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
@@ -336,8 +336,6 @@ namespace Orchard.FileSystems.Media {
|
|||||||
// The CreateFile method will map the still relative path
|
// The CreateFile method will map the still relative path
|
||||||
var file = CreateFile(path);
|
var file = CreateFile(path);
|
||||||
|
|
||||||
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()) {
|
using (var outputStream = file.OpenWrite()) {
|
||||||
var buffer = new byte[8192];
|
var buffer = new byte[8192];
|
||||||
for (; ; ) {
|
for (; ; ) {
|
||||||
@@ -348,8 +346,6 @@ namespace Orchard.FileSystems.Media {
|
|||||||
outputStream.Write(buffer, 0, length);
|
outputStream.Write(buffer, 0, length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inputStream.Position = 0; // Rolling back the stream so external readers will have it easier.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user