Code Monkey home page Code Monkey logo

Comments (3)

8secz-johndpope avatar 8secz-johndpope commented on June 26, 2024
  func convertURLToUniqueFileName() -> String {
        guard let _ = URL(string: self) else {
            fatalError("\(self) is not a valid URL")
        }
        return self.md5
    }
    

from celestial.

johndpope avatar johndpope commented on June 26, 2024

on an out of date branch.

from celestial.

8secz-johndpope avatar 8secz-johndpope commented on June 26, 2024

I think using lastPathComponent + md5 is better way to handle filenames.

https://blablabla.com/test.mp4 -> test.mp4 -> 123412341234123412343
sourceURL.lastPathComponent.convertURLToUniqueFileName()

func convertURLToUniqueFileName() -> String {
guard let _ = URL(string: self) else {
fatalError("(self) is not a valid URL")
}
return self.md5
}

It's possible the urls will be too large for file system.

/tmp/. Directory contents: ["httpsd21m91m763fb64.cloudfront.netvideos-540p19f1efb0-8a1e-11eb-8bc7-65134f4b7bab-.mp4", "https:__d21m91m763fb64.cloudfront.net_videos-540p_d9379510-903f-11eb-9a88-f5ff80ee2719-.mp4", "https:__d21m91m763fb64.cloudfront.net_videos-540p_9edc1cd0-a9f1-11eb-b98a-69bcf457ca9a-.mp4", "httpsd21m91m763fb64.cloudfront.netvideos-540pe4b390e0-8560-11eb-822b-3bb0ffb6770c-.mp4", "https:__d21m91m763fb64.cloudfront.net_videos-540p_22114af0-82cc-11eb-a662-35cb0ee94b96-.mp4", "stack-logs.3760.10e1dc000.8secondz.8SFCWk.index", "https:__d21m91m763fb64.cloudfront.net_videos-540p_51180470-9856-11eb-968f-297a20a6926d-.mp4", "instrument", "https:__d21m91m763fb64.cloudfront.net_videos-540p_b28a8d60-7dfb-11eb-aff5-433e586b7aee-.mp4

I can't explain why - but I'm seeing inexplicable failure to move the file from tmp to Celestial folder.

I'll draft a new branch with last path component for your review.

from celestial.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.