Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileManager when the folder Path is set and ShowFolder = False #3057

Closed
vnetonline opened this issue Jul 23, 2023 · 5 comments
Closed

FileManager when the folder Path is set and ShowFolder = False #3057

vnetonline opened this issue Jul 23, 2023 · 5 comments

Comments

@vnetonline
Copy link
Contributor

vnetonline commented Jul 23, 2023

In a recent change to FileManager #3049 logic was added to show folders, however, when the Folder is set with a path like Public and ShowFolder = False results in an error

<FileManager FileId="@_slideFileId" Filter="@Constants.ImageFiles" ShowFolders="false" ShowFiles="true" UploadMultiple="false" Folder=@_publicFolder @ref="fileManager" OnSelect="PopulateFileName" />

System.ArgumentNullException: Value cannot be null. (Parameter 'source')
   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at Oqtane.Modules.Controls.FileManager.GetFiles() in C:\Projects\oqtane.framework\Oqtane.Client\Modules\Controls\FileManager.razor:line 247
   at Oqtane.Modules.Controls.FileManager.OnParametersSetAsync() in C:\Projects\oqtane.framework\Oqtane.Client\Modules\Controls\FileManager.razor:line 226
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

In this case, the FolderId should be set first based on the Path

vnetonline added a commit to vnetonline/oqtane.framework that referenced this issue Jul 23, 2023
@vnetonline
Copy link
Contributor Author

vnetonline commented Jul 25, 2023

I have also discovered that this change which was made in #3049 is preventing from uploading modules and themes the error is shown below

System.FormatException: The input string 'Packages' was not in a correct format.
   at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, ReadOnlySpan`1 value, TypeCode type)
   at Oqtane.Modules.Controls.FileManager.UploadFiles() in D:\a\1\s\Oqtane.Client\Modules\Controls\FileManager.razor:line 361

Pull request #3058 fixes this issue as well

@MPatriot
Copy link

I also am having a problem uploading files
I wasn’t aware of any show/hide folder settings but that sounds about right because I can’t see folders I added. Also, I can’t seem to get an upload to complete: about halfway through or more an error message shows a message that file upload has either failed or is taking a long time. Then when the progress bar shows complete there is no file

@sbwalker
Copy link
Member

sbwalker commented Jul 31, 2023

@vnetonline the Folder property on the FileManager was only ever intended to be used for 1 specific use case - uploading to the /Packages folder which is a "system" folder that does not have an entry in the Folder table in the database. If you are trying to set a specific default folder in the FileManager you should be using the FolderId property. If you look through the Oqtane framework source code you will see many examples of the usage.

@vnetonline
Copy link
Contributor Author

vnetonline commented Jul 31, 2023

@sbwalker Appreciate your answer and I understand that the folder property was intended for only the packages folder but by this change it would allow us to set the folder in cases like when we want to just upload images for files which are publicly able.

I could change my code in my module HeroSlider which needs to upload Hero images to publicly browsable folder

That being said I could look for a Public folder but just like Packages it would be good to set the Public folder via the folder property

@sbwalker
Copy link
Member

@vnetonline the original post made it sound like it was an issue caused by a recent change in a prior version - however you are now clarifying that this is actually an enhancement. I will review the PR with this new context in mind.

vnetonline added a commit to vnetonline/oqtane.framework that referenced this issue Aug 1, 2023
sbwalker added a commit that referenced this issue Aug 2, 2023
[ENHANCE] - #3057 FileManager when ShowFolders = False however a Folder is set by path
@sbwalker sbwalker closed this as completed Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants