fix: resolve InputFile destruction exception during stream read
This commit is contained in:
@@ -16,18 +16,16 @@
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
@if (IsParsing)
|
||||
{
|
||||
<div class="parsing-state shimmer">
|
||||
<div class="shimmer-content">
|
||||
<div class="spinner"></div>
|
||||
<p>Scanning metadata...</p>
|
||||
</div>
|
||||
<div class="parsing-state shimmer" style="@(IsParsing ? "display:flex;" : "display:none;")">
|
||||
<div class="shimmer-content">
|
||||
<div class="spinner"></div>
|
||||
<p>Scanning metadata...</p>
|
||||
</div>
|
||||
}
|
||||
else if (Metadata != null)
|
||||
{
|
||||
<div class="metadata-state">
|
||||
</div>
|
||||
|
||||
<div class="metadata-state" style="@(Metadata != null && !IsParsing ? "display:flex;" : "display:none;")">
|
||||
@if (Metadata != null)
|
||||
{
|
||||
<div class="metadata-info">
|
||||
<h3>@Metadata.Title</h3>
|
||||
<p class="author">@Metadata.Author</p>
|
||||
@@ -36,23 +34,23 @@
|
||||
<button class="btn btn-primary">Confirm & Upload</button>
|
||||
<button class="btn btn-secondary" @onclick="Reset">Cancel</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="upload-state @(_isDragging ? "drag-over" : "")"
|
||||
style="@(!IsParsing && Metadata == null ? "display:flex;" : "display:none;")"
|
||||
@ondragenter="OnDragEnter"
|
||||
@ondragleave="OnDragLeave">
|
||||
<div class="drop-zone">
|
||||
<InputFile id="epub-upload" OnChange="HandleFileSelected" accept=".epub" class="file-input-cover" />
|
||||
<div class="drop-zone-content">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="17 8 12 3 7 8"></polyline><line x1="12" y1="3" x2="12" y2="15"></line></svg>
|
||||
<p>Drag and drop your .epub file here</p>
|
||||
<span>or click to browse</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="upload-state @(_isDragging ? "drag-over" : "")"
|
||||
@ondragenter="OnDragEnter"
|
||||
@ondragleave="OnDragLeave">
|
||||
<label for="epub-upload" class="drop-zone">
|
||||
<div class="drop-zone-content">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="17 8 12 3 7 8"></polyline><line x1="12" y1="3" x2="12" y2="15"></line></svg>
|
||||
<p>Drag and drop your .epub file here</p>
|
||||
<span>or click to browse</span>
|
||||
</div>
|
||||
<InputFile id="epub-upload" OnChange="HandleFileSelected" accept=".epub" class="file-input" />
|
||||
</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
@if (!string.IsNullOrEmpty(ErrorMessage))
|
||||
{
|
||||
@@ -138,7 +136,7 @@
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, "Error uploading EPUB");
|
||||
ErrorMessage = "An unexpected error occurred.";
|
||||
ErrorMessage = $"An unexpected error occurred: {ex.Message} \n {ex.StackTrace}";
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.drop-zone:hover, .upload-state.drag-over .drop-zone {
|
||||
@@ -90,6 +91,7 @@
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
color: var(--nexus-text-muted, #888);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.drop-zone-content svg {
|
||||
@@ -103,8 +105,15 @@
|
||||
color: var(--nexus-text);
|
||||
}
|
||||
|
||||
.file-input {
|
||||
display: none;
|
||||
.file-input-cover {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
/* Parsing State */
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="VersOne.Epub" Version="3.3.6" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user