@@ -22,103 +22,22 @@ internal static StorageResourceItemProperties ToStorageResourceProperties(this F
2222 } ;
2323 }
2424
25- public static StreamToUriJobPart ToStreamToUriJobPartAsync (
26- this TransferJobInternal baseJob ,
27- JobPartPlanHeader header ,
28- StorageResourceItem sourceResource ,
29- StorageResourceItem destinationResource )
30- {
31- // Override header values if options were specified by user.
32- long initialTransferSize = baseJob . _initialTransferSize ?? header . InitialTransferSize ;
33- long transferChunkSize = baseJob . _maximumTransferChunkSize ?? header . ChunkSize ;
34- StorageResourceCreationMode createPreference =
35- baseJob . _creationPreference != StorageResourceCreationMode . Default ?
36- baseJob . _creationPreference : header . CreatePreference ;
37-
38- StreamToUriJobPart jobPart = StreamToUriJobPart . CreateJobPartFromCheckpoint (
39- job : baseJob ,
40- partNumber : Convert . ToInt32 ( header . PartNumber ) ,
41- sourceResource : sourceResource ,
42- destinationResource : destinationResource ,
43- jobPartStatus : header . JobPartStatus ,
44- initialTransferSize : initialTransferSize ,
45- transferChunkSize : transferChunkSize ,
46- createPreference : createPreference ) ;
47-
48- jobPart . VerifyJobPartPlanHeader ( header ) ;
49-
50- // TODO: When enabling resume chunked upload Add each transfer to the CommitChunkHandler
51- return jobPart ;
52- }
53-
54- public static ServiceToServiceJobPart ToServiceToServiceJobPartAsync (
55- this TransferJobInternal baseJob ,
56- JobPartPlanHeader header ,
57- StorageResourceItem sourceResource ,
58- StorageResourceItem destinationResource )
59- {
60- // Override header values if options were specified by user.
61- long initialTransferSize = baseJob . _initialTransferSize ?? header . InitialTransferSize ;
62- long transferChunkSize = baseJob . _maximumTransferChunkSize ?? header . ChunkSize ;
63- StorageResourceCreationMode createPreference =
64- baseJob . _creationPreference != StorageResourceCreationMode . Default ?
65- baseJob . _creationPreference : header . CreatePreference ;
66-
67- ServiceToServiceJobPart jobPart = ServiceToServiceJobPart . CreateJobPartFromCheckpoint (
68- job : baseJob ,
69- partNumber : Convert . ToInt32 ( header . PartNumber ) ,
70- sourceResource : sourceResource ,
71- destinationResource : destinationResource ,
72- jobPartStatus : header . JobPartStatus ,
73- initialTransferSize : initialTransferSize ,
74- transferChunkSize : transferChunkSize ,
75- createPreference : createPreference ) ;
76-
77- jobPart . VerifyJobPartPlanHeader ( header ) ;
78-
79- // TODO: When enabling resume chunked upload Add each transfer to the CommitChunkHandler
80- return jobPart ;
81- }
82-
83- public static UriToStreamJobPart ToUriToStreamJobPartAsync (
84- this TransferJobInternal baseJob ,
85- JobPartPlanHeader header ,
86- StorageResourceItem sourceResource ,
87- StorageResourceItem destinationResource )
88- {
89- // Override header values if options were specified by user.
90- long initialTransferSize = baseJob . _initialTransferSize ?? header . InitialTransferSize ;
91- long transferChunkSize = baseJob . _maximumTransferChunkSize ?? header . ChunkSize ;
92- StorageResourceCreationMode createPreference =
93- baseJob . _creationPreference != StorageResourceCreationMode . Default ?
94- baseJob . _creationPreference : header . CreatePreference ;
95-
96- UriToStreamJobPart jobPart = UriToStreamJobPart . CreateJobPartFromCheckpoint (
97- job : baseJob ,
98- partNumber : Convert . ToInt32 ( header . PartNumber ) ,
99- sourceResource : sourceResource ,
100- destinationResource : destinationResource ,
101- jobPartStatus : header . JobPartStatus ,
102- initialTransferSize : initialTransferSize ,
103- transferChunkSize : transferChunkSize ,
104- createPreference : createPreference ) ;
105-
106- jobPart . VerifyJobPartPlanHeader ( header ) ;
107-
108- // TODO: When enabling resume chunked upload Add each transfer to the CommitChunkHandler
109- return jobPart ;
110- }
111-
11225 public static StreamToUriJobPart ToStreamToUriJobPartAsync (
11326 this TransferJobInternal baseJob ,
11427 JobPartPlanHeader header ,
11528 StorageResourceContainer sourceResource ,
11629 StorageResourceContainer destinationResource )
11730 {
31+ // If saved path equals the cotnainer Uri, its a single item trasfer.
32+ // Set the resource name to the full Uri.
11833 string childSourcePath = header . SourcePath ;
119- string childSourceName = childSourcePath . Substring ( sourceResource . Uri . AbsoluteUri . Length + 1 ) ;
34+ string childSourceName = header . SourcePath == sourceResource . Uri . AbsoluteUri . ToString ( ) ?
35+ childSourcePath :
36+ childSourcePath . Substring ( sourceResource . Uri . AbsoluteUri . Length + 1 ) ;
12037 string childDestinationPath = header . DestinationPath ;
121- string childDestinationName = childDestinationPath . Substring ( destinationResource . Uri . AbsoluteUri . Length + 1 ) ;
38+ string childDestinationName = header . DestinationPath == destinationResource . Uri . AbsoluteUri . ToString ( ) ?
39+ childDestinationPath :
40+ childDestinationPath . Substring ( destinationResource . Uri . AbsoluteUri . Length + 1 ) ;
12241 // Override header values if options were specified by user.
12342 long initialTransferSize = baseJob . _initialTransferSize ?? header . InitialTransferSize ;
12443 long transferChunkSize = baseJob . _maximumTransferChunkSize ?? header . ChunkSize ;
@@ -148,8 +67,16 @@ public static ServiceToServiceJobPart ToServiceToServiceJobPartAsync(
14867 StorageResourceContainer sourceResource ,
14968 StorageResourceContainer destinationResource )
15069 {
70+ // If saved path equals the cotnainer Uri, its a single item trasfer, so the resource name
71+ // does not matter. Just set it to the path.
15172 string childSourcePath = header . SourcePath ;
73+ string childSourceName = header . SourcePath == sourceResource . Uri . AbsoluteUri . ToString ( ) ?
74+ childSourcePath :
75+ childSourcePath . Substring ( sourceResource . Uri . AbsoluteUri . Length + 1 ) ;
15276 string childDestinationPath = header . DestinationPath ;
77+ string childDestinationName = header . DestinationPath == destinationResource . Uri . AbsoluteUri . ToString ( ) ?
78+ childDestinationPath :
79+ childDestinationPath . Substring ( destinationResource . Uri . AbsoluteUri . Length + 1 ) ;
15380 // Override header values if options were specified by user.
15481 long initialTransferSize = baseJob . _initialTransferSize ?? header . InitialTransferSize ;
15582 long transferChunkSize = baseJob . _maximumTransferChunkSize ?? header . ChunkSize ;
@@ -160,8 +87,8 @@ public static ServiceToServiceJobPart ToServiceToServiceJobPartAsync(
16087 ServiceToServiceJobPart jobPart = ServiceToServiceJobPart . CreateJobPartFromCheckpoint (
16188 job : baseJob ,
16289 partNumber : Convert . ToInt32 ( header . PartNumber ) ,
163- sourceResource : sourceResource . GetStorageResourceReference ( childSourcePath . Substring ( sourceResource . Uri . AbsoluteUri . Length + 1 ) , header . SourceTypeId ) ,
164- destinationResource : destinationResource . GetStorageResourceReference ( childDestinationPath . Substring ( destinationResource . Uri . AbsoluteUri . Length + 1 ) , header . DestinationTypeId ) ,
90+ sourceResource : sourceResource . GetStorageResourceReference ( childSourceName , header . SourceTypeId ) ,
91+ destinationResource : destinationResource . GetStorageResourceReference ( childDestinationName , header . DestinationTypeId ) ,
16592 jobPartStatus : header . JobPartStatus ,
16693 initialTransferSize : initialTransferSize ,
16794 transferChunkSize : transferChunkSize ,
@@ -179,11 +106,16 @@ public static UriToStreamJobPart ToUriToStreamJobPartAsync(
179106 StorageResourceContainer sourceResource ,
180107 StorageResourceContainer destinationResource )
181108 {
182- // Apply credentials to the saved transfer job path
109+ // If saved path equals the cotnainer Uri, its a single item trasfer, so the resource name
110+ // does not matter. Just set it to the path.
183111 string childSourcePath = header . SourcePath ;
184- string childSourceName = childSourcePath . Substring ( sourceResource . Uri . AbsoluteUri . Length + 1 ) ;
112+ string childSourceName = header . SourcePath == sourceResource . Uri . AbsoluteUri . ToString ( ) ?
113+ childSourcePath :
114+ childSourcePath . Substring ( sourceResource . Uri . AbsoluteUri . Length + 1 ) ;
185115 string childDestinationPath = header . DestinationPath ;
186- string childDestinationName = childDestinationPath . Substring ( destinationResource . Uri . AbsoluteUri . Length + 1 ) ;
116+ string childDestinationName = header . DestinationPath == destinationResource . Uri . AbsoluteUri . ToString ( ) ?
117+ childDestinationPath :
118+ childDestinationPath . Substring ( destinationResource . Uri . AbsoluteUri . Length + 1 ) ;
187119 // Override header values if options were specified by user.
188120 long initialTransferSize = baseJob . _initialTransferSize ?? header . InitialTransferSize ;
189121 long transferChunkSize = baseJob . _maximumTransferChunkSize ?? header . ChunkSize ;
0 commit comments