Terminal-Icons icon indicating copy to clipboard operation
Terminal-Icons copied to clipboard

One drive - requires downloading all files to function

Open Xeue opened this issue 3 years ago • 7 comments

If you are using onedrive (I assume other cloud providers too?) this has to download the file in order to work out it's icon. This takes a longtime and downloads a lot of files you may not want locally.

Expected Behavior

???

Current Behavior

When listing files in a onedrive folder, it has to download the files first to work out the icon

Possible Solution

Possibly have an option to only load icons if there is a local copy. If file is not local try and use the file extension?

Steps to Reproduce (for bugs)

  1. Navigate to a onedrive folder with files that you have not downloaded
  2. Type dir
  3. Sadness

Context

Accidentally downloaded 100GB of video files by accident...

Your Environment

Win 11 Windows terminal Used alongside oh so posh Whatever the latest version was at the time of writing (soz)

Xeue avatar Mar 22 '22 16:03 Xeue

Thanks for the issue @Xeue. That's definitely not a good experience. I don't think Terminal-Icons does anything explicit to pull down the file (we don't do reads on the file itself). We only access properties from the System.IO.FileSystemInfo object passed from Get-ChildItem. I'll do some research on why this is happening and if we can mitigate it.

devblackops avatar Mar 22 '22 16:03 devblackops

I did realise as writing it that you don't use the file content, strange how that works... I've been having these kind of issues in a couple of programs recently and with some googling I'm not the only one. It could be a windows 11 thing maybe? I am on the insider dev builds at the moment (22579) I'll test on my win 10 PC when I get home. Aside from that, great work, lovely little tool

Xeue avatar Mar 22 '22 16:03 Xeue

I can't reproduce this problem on my system.

drwtsn32x avatar Mar 22 '22 23:03 drwtsn32x

I can't repro it either. Usually there will be a pop-up in Windows tell you that a certain program is downloading a file. Ripgrep for instance this happens on for me.

mattcargile avatar Mar 27 '22 01:03 mattcargile

I have tested further, it doesn't occur on my main machine. Only my secondary, and since the time of reporting I have moved to the next insider builder and it's gone away. So false alarm! Windows insider things... Apologies all.

Xeue avatar Mar 27 '22 19:03 Xeue

I take it back, now it's happening on my main machine. I am indeed getting the windows "Automatic file downloads" popup when I do this.

Xeue avatar Mar 27 '22 19:03 Xeue

I wonder if there is something else going on with your type data in your $PROFILE or something else? Additionally, seeing as you are on an Insider build, I wonder if there is something new within [FileInfo] or [DirectoryInfo] that is causing the download to occur. What version of .NET are you running?

Post your type data in a session where this behavior is presenting. The below code works on PowerShell 7.2.2 and may not work on 5.1 to grab the type data.

Get-FormatData System.IO.DirectoryInfo, System.IO.FileInfo | Export-FormatData -path filedirinfo.ps1xml -IncludeScriptBlock

Here is some code to run in your impacted PowerShell session to grab the .NET version.

[System.Runtime.InteropServices.RuntimeInformation]::get_FrameworkDescription()

I'd also try to rule out the $PROFILE by running a pwsh -noprofile -noexit -Command ipmo terminal-icons to see if the behavior happens.

mattcargile avatar Mar 28 '22 11:03 mattcargile