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

If a dependency contains spaces in its path it is treated as an external request and cannot be resolved during composite file processing #124

Open
braydie opened this issue Sep 11, 2017 · 1 comment

Comments

@braydie
Copy link

braydie commented Sep 11, 2017

As part of the building the encoded request for dependencies, if a file path contains a space it is encoded as %20 and stored. This means that when it comes to resolving files to combine, the framework is unable to process this file as a local file because the call to File.Exists(...) will fail and the dependency is excluded from the output.

As part of debugging it locally I was able to fix the issue by updating BaseCompositeFileProcessingProviders WritePathToStream method on line 137 to include path = path.Replace("%20", " ");. Obviously this will not work going forward as having %20 in your filename is valid (but maybe weird), but fixes it in my case.

Is there a better place for this fix to be applied? I'm not massively familiar with the inner workings of CDF and maybe wondered if there was something to be done in the BaseFileMapProvider?

Any advice is greatly appreciated

@braydie
Copy link
Author

braydie commented Sep 11, 2017

I've worked around this in a better way - rather than changing the underlying source I've implemented by own Composite File Processing Provider:

public class FixWhitespaceInPathCompositeFileProcessingProvider : CompositeFileProcessingProvider
    {        
        public override byte[] CombineFiles(string[] FilePaths, HttpContextBase Context, ClientDependencyType Type, out List<CompositeFileDefinition> FileDefs)
        {
            FilePaths = FilePaths.Select(s => s.Replace("%20", " ")).ToArray();
            return base.CombineFiles(FilePaths, Context, Type, out FileDefs);
        }     
    }

This is a better solution longer term I guess

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

1 participant