<commit_before>﻿using System;
using System.IO;
using System.ServiceModel.Syndication;
using System.Web;
using System.Web.Mvc;

namespace NuPack.Server.Controllers {
    public class PackagesController : Controller {
        private const string PackageVirtualPath = "~/Packages";
        //
        // GET: /Packages/

        public ActionResult Index() {
            return View();
        }

        // ?p=filename
        public ActionResult Download(string p) {
            string physicalPath = Server.MapPath(PackageVirtualPath);
            string fullPath = Path.Combine(physicalPath, p);

            DateTime lastModified = new FileInfo(fullPath).LastAccessTimeUtc;
            DateTime ifModifiedSince;
            if (DateTime.TryParse(Request.Headers["If-Modified-Since"], out ifModifiedSince) &&
                lastModified > ifModifiedSince) {
                Response.StatusCode = 304;
                return new EmptyResult();
            }

            HttpCachePolicyBase cachePolicy = Response.Cache;
            cachePolicy.SetCacheability(HttpCacheability.Public);
            cachePolicy.SetExpires(DateTime.Now.AddMinutes(30));
            cachePolicy.SetValidUntilExpires(true);
            // Vary by package file
            cachePolicy.VaryByParams["p"] = true;
            cachePolicy.SetLastModified(lastModified);

            return File(fullPath, "application/zip", p);
        }

        public ActionResult Feed() {
            // Get the full directory path
            string fullPath = Server.MapPath(PackageVirtualPath);

            // Get the last modified of the package directory
            DateTime lastModified = new DirectoryInfo(fullPath).LastWriteTimeUtc;
            DateTime ifModifiedSince;
            if (DateTime.TryParse(Request.Headers["If-Modified-Since"], out ifModifiedSince) &&
                lastModified > ifModifiedSince) {
                Response.StatusCode = 304;
                return new EmptyResult();
            }<commit_msg>Remove redundant If modified since check.<commit_after>﻿using System;
using System.IO;
using System.ServiceModel.Syndication;
using System.Web;
using System.Web.Mvc;

namespace NuPack.Server.Controllers {
    public class PackagesController : Controller {
        private const string PackageVirtualPath = "~/Packages";
        //
        // GET: /Packages/

        public ActionResult Index() {
            return View();
        }

        // ?p=filename
        public ActionResult Download(string p) {
            string physicalPath = Server.MapPath(PackageVirtualPath);
            string fullPath = Path.Combine(physicalPath, p);

            DateTime lastModified = new FileInfo(fullPath).LastAccessTimeUtc;

            HttpCachePolicyBase cachePolicy = Response.Cache;
            cachePolicy.SetCacheability(HttpCacheability.Public);
            cachePolicy.SetExpires(DateTime.Now.AddMinutes(30));
            cachePolicy.SetValidUntilExpires(true);
            // Vary by package file
            cachePolicy.VaryByParams["p"] = true;
            cachePolicy.SetLastModified(lastModified);

            return File(fullPath, "application/zip", p);
        }

        public ActionResult Feed() {
            // Get the full directory path
            string fullPath = Server.MapPath(PackageVirtualPath);

            // Get the last modified of the package directory
            DateTime lastModified = new DirectoryInfo(fullPath).LastWriteTimeUtc;
{'fraction_non_alphanumeric': 0.08516166281755197, 'fraction_numerical': 0.002886836027713626, 'mean_word_length': 2.271954674220963, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2265967', 'n_tokens_mistral': 862, 'n_tokens_neox': 826, 'n_words': 199}