Skip to content

Commit

Permalink
[Fix] image file share access
Browse files Browse the repository at this point in the history
  • Loading branch information
fy0 committed Apr 10, 2024
1 parent 5510f5f commit 4ce2b70
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Lagrange.Core/Message/Entity/ImageEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public ImageEntity() { }
public ImageEntity(string filePath)
{
FilePath = filePath;
ImageStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
ImageStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
}

public ImageEntity(byte[] file)
Expand Down
2 changes: 1 addition & 1 deletion Lagrange.OneBot/Core/Operation/OperationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public OperationService(BotContext bot, ILogger<OperationService> logger, LiteDa
}
catch (Exception ex)
{
_logger.LogWarning(ex, "Unexpected error encountered while handling message.");
_logger.LogFatal(ex, "Unexpected error encountered while handling message.");

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / build (linux-arm64)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / build (linux-musl-arm64)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / build (win-x64)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / build (linux-arm)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / build (osx-arm64)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / build (win-x86)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / build (linux-musl-arm)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / build (osx-x64)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / build (linux-x64)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / build (linux-musl-x64)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / Build (linux-musl-arm)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / Build (linux-arm)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / Build (linux-musl-x64)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / Build (linux-x64)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / Build (linux-musl-arm64)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / Build (linux-arm64)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / Build-Android (linux-bionic-x64)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / Build (osx-arm64)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / Build (osx-x64)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in Lagrange.OneBot/Core/Operation/OperationService.cs

View workflow job for this annotation

GitHub Actions / Build-Android (linux-bionic-arm64)

'ILogger' does not contain a definition for 'LogFatal' and no accessible extension method 'LogFatal' accepting a first argument of type 'ILogger' could be found (are you missing a using directive or an assembly reference?)
return new OneBotResult(null, 200, "failed") { Echo = action.Echo };
}
}
Expand Down
2 changes: 1 addition & 1 deletion Lagrange.OneBot/Message/Entity/CommonResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static class CommonResolver
return uri.Scheme switch
{
"http" or "https" => Client.GetAsync(uri).Result.Content.ReadAsStreamAsync().Result,
"file" => new FileStream(Path.GetFullPath(uri.LocalPath), FileMode.Open),
"file" => new FileStream(Path.GetFullPath(uri.LocalPath), FileMode.Open, FileAccess.Read, FileShare.Read),
_ => null,
};
}
Expand Down

0 comments on commit 4ce2b70

Please sign in to comment.