getUrlFormatedToFilepath method Null safety

String getUrlFormatedToFilepath(
  1. String originalUrl
)

Implementation

static String getUrlFormatedToFilepath(String originalUrl) {
  String url = originalUrl;
  url = url.replaceAll("https:", "");
  url = url.replaceAll("/", "");
  url = url.replaceAll("_", "");
  url = url.replaceAll("=", "");
  url = url.replaceAll(".", "");
  url = url.replaceAll("-", "");
  url = url.replaceAll("&", "");
  url = url.replaceAll("%20", "");
  url = url.replaceAll("%2F", "");
  url = url.replaceAll(" ", "");
  url = url.replaceAll("?", "");

  if (url.length > fileNameMaxLenght) {
    url = url.substring(0, fileNameMaxLenght - 1);
  }

  return url;
}