Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/NuGet/NuGetGallery into sb-e…
Browse files Browse the repository at this point in the history
…mailhotfixdev
  • Loading branch information
Scott Bommarito committed Nov 9, 2018
2 parents 0b177de + 9855ce7 commit f59105c
Show file tree
Hide file tree
Showing 90 changed files with 2,944 additions and 373 deletions.
34 changes: 21 additions & 13 deletions src/NuGetGallery.Core/CoreConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public static class CoreConstants

public const string PackageFileSavePathTemplate = "{0}.{1}{2}";
public const string PackageFileBackupSavePathTemplate = "{0}/{1}/{2}.{3}";
public const string PackageContentFileSavePathTemplate = "{0}/{1}";

public const string NuGetPackageFileExtension = ".nupkg";
public const string CertificateFileExtension = ".cer";
Expand All @@ -18,26 +19,33 @@ public static class CoreConstants
public const string PackageContentType = "binary/octet-stream";
public const string OctetStreamContentType = "application/octet-stream";
public const string TextContentType = "text/plain";
public const string MarkdownContentType = "text/markdown"; // rfc7763
public const string CertificateContentType = "application/pkix-cert";
public const string JsonContentType = "application/json";

public const string DefaultCacheControl = "max-age=120";

public const string UserCertificatesFolderName = "user-certificates";
public const string ContentFolderName = "content";
public const string DownloadsFolderName = "downloads";
public const string PackageBackupsFolderName = "package-backups";
public const string PackageReadMesFolderName = "readmes";
public const string PackagesFolderName = "packages";
public const string UploadsFolderName = "uploads";
public const string ValidationFolderName = "validation";
public const string RevalidationFolderName = "revalidation";
public const string StatusFolderName = "status";

public const string SymbolPackagesFolderName = "symbol-packages";
public static class Folders
{
public const string UserCertificatesFolderName = "user-certificates";
public const string ContentFolderName = "content";
public const string DownloadsFolderName = "downloads";
public const string PackageBackupsFolderName = "package-backups";
public const string PackageReadMesFolderName = "readmes";
public const string PackagesFolderName = "packages";
public const string PackagesContentFolderName = "packages-content";
public const string UploadsFolderName = "uploads";
public const string ValidationFolderName = "validation";
public const string RevalidationFolderName = "revalidation";
public const string StatusFolderName = "status";
public const string SymbolPackagesFolderName = "symbol-packages";
public const string SymbolPackageBackupsFolderName = "symbol-package-backups";
}

public const string NuGetSymbolPackageFileExtension = ".snupkg";
public const string SymbolPackageBackupsFolderName = "symbol-package-backups";

public const string UploadTracingKeyHeaderName = "upload-id";

public const string LicenseFileName = "license";
}
}
26 changes: 26 additions & 0 deletions src/NuGetGallery.Core/EmbeddedLicenseFileType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

namespace NuGetGallery
{
/// <summary>
/// Specifies the type of the license file used in the package
/// </summary>
public enum EmbeddedLicenseFileType
{
/// <summary>
/// Indicates that package has no license file embedded.
/// </summary>
Absent = 0,

/// <summary>
/// Indicates that embedded license file is plain text.
/// </summary>
PlainText = 1,

/// <summary>
/// Indicates that embedded license file is markdown.
/// </summary>
Markdown = 2,
}
}
2 changes: 2 additions & 0 deletions src/NuGetGallery.Core/NuGetGallery.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
<ItemGroup>
<PackageReference Include="NuGet.Services.Messaging.Email">
<Version>2.36.0-sb-noemailrecipients-2192794</Version>
<Version>2.36.0</Version>
</PackageReference>
<PackageReference Include="NuGet.StrongName.AnglicanGeek.MarkdownMailer">
<Version>1.2.0</Version>
Expand Down Expand Up @@ -237,6 +238,7 @@
</PackageReference>
<PackageReference Include="NuGet.Packaging">
<Version>4.8.0</Version>
<Version>5.0.0-preview1.5665</Version>
</PackageReference>
<PackageReference Include="WindowsAzure.Storage">
<Version>7.1.2</Version>
Expand Down
14 changes: 12 additions & 2 deletions src/NuGetGallery.Core/Packaging/PackageMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public PackageMetadata(
IEnumerable<FrameworkSpecificGroup> frameworkGroups,
IEnumerable<NuGet.Packaging.Core.PackageType> packageTypes,
NuGetVersion minClientVersion,
RepositoryMetadata repositoryMetadata)
RepositoryMetadata repositoryMetadata,
LicenseMetadata licenseMetadata = null)
{
_metadata = new Dictionary<string, string>(metadata, StringComparer.OrdinalIgnoreCase);
_dependencyGroups = dependencyGroups.ToList().AsReadOnly();
Expand All @@ -67,6 +68,8 @@ public PackageMetadata(
RepositoryUrl = repoUrl;
RepositoryType = repositoryMetadata.Type;
}

LicenseMetadata = licenseMetadata;
}

private void SetPropertiesFromMetadata()
Expand Down Expand Up @@ -123,6 +126,12 @@ private void SetPropertiesFromMetadata()
public string Language { get; private set; }
public NuGetVersion MinClientVersion { get; set; }

/// <summary>
/// Contains license metadata taken from the 'license' node of the nuspec file.
/// Null if no 'license' node present.
/// </summary>
public LicenseMetadata LicenseMetadata { get; }

public string GetValueFromMetadata(string key)
{
return GetValue(key, (string)null);
Expand Down Expand Up @@ -244,7 +253,8 @@ public static PackageMetadata FromNuspecReader(NuspecReader nuspecReader, bool s
nuspecReader.GetFrameworkReferenceGroups(),
nuspecReader.GetPackageTypes(),
nuspecReader.GetMinClientVersion(),
nuspecReader.GetRepositoryMetadata());
nuspecReader.GetRepositoryMetadata(),
nuspecReader.GetLicenseMetadata());
}

private class StrictNuspecReader : NuspecReader
Expand Down
Loading

0 comments on commit f59105c

Please sign in to comment.