import { _ as _slicedToArray } from './slicedToArray-6ebcbfea.js';

var urlForFile = function urlForFile(_ref) {
  var _ref$asset = _ref.asset,
      asset = _ref$asset === undefined ? {} : _ref$asset;
  var url = asset.url,
      originalFilename = asset.originalFilename;
  // Appending file name in URL

  if (url && originalFilename) {
    var _url$split = url.split('?'),
        _url$split2 = _slicedToArray(_url$split, 2),
        path = _url$split2[0],
        queryString = _url$split2[1];

    originalFilename = encodeURIComponent(originalFilename);
    url = queryString ? path + '/' + originalFilename + '?' + queryString : path + '/' + originalFilename;
  }
  return url;
};

export { urlForFile as u };
